jQWidgets Forums
Forum Replies Created
-
Author
-
December 17, 2015 at 4:44 pm in reply to: Search box in JQX Grid as in JQX Datatable Search box in JQX Grid as in JQX Datatable #79474
+1 for Sibeesh’s question — this should be something available in any data grid. Our clients need this functionality for their incredibly dense data views. I’m very surprised there is no setting for it. I hope it will be included in an updated release, at which point we might actually use it.
August 13, 2015 at 2:06 pm in reply to: Sorting Throws Errors + Sorting Alphanumerics Sorting Throws Errors + Sorting Alphanumerics #74803Unfortunately, that approach returns a sort that reads (assuming 11 results):
Foo-2
Foo-3
Foo-4
Foo-5
Foo-1
Foo-6
Foo-7
Foo-8
Foo-9
Foo-10
Foo-11It is the same result whether one sorts ascending or descending. I confess I’m surprised no one has ever brought a similarly mixed alphanumeric sort case to your attention before, it seems as though it would be a pretty standard utilization. I’ll put in a request for future versions having this functionality. In the event I am getting the complete custom sorting scenario wrong, please see sample code below trying to get this going. Thank you once more for your attention and assistance.
var customsortfunc = function (column, direction) { var sortdata = new Array(); if (direction == 'ascending') direction = true; if (direction == 'descending') direction = false; if (direction != null) { for (i = 0; i < dataFields.length; i++) { sortdata.push(dataFields[i]); } } else sortdata = dataFields; var tmpToString = Object.prototype.toString; Object.prototype.toString = (typeof column == "function") ? column : function () { return this[column] }; if (direction != null) { sortdata.sort(compare); if (!direction) { sortdata.reverse(); } } source.localdata = sortdata; $("#evaluations-grid").jqxGrid('updatebounddata', 'sort'); Object.prototype.toString = tmpToString; } var compare = function(value1, value2) { value1 = value1.slice(5); // returns only the number after "Eval-" value2 = value2.slice(5); // returns only the number after "Eval-" try { var tmpvalue1 = parseFloat(value1); if (isNaN(tmpvalue1)) { if (value1 < value2) { return -1; } if (value1 > value2) { return 1; } } else { var tmpvalue2 = parseFloat(value2); if (tmpvalue1 < tmpvalue2) { return -1; } if (tmpvalue1 > tmpvalue2) { return 1; } } } catch (error) { var er = error; } return 0; }; var source = { datatype: "json", datafields: dataFields, id: 'session_name', url: url, sort: customsortfunc, sortcolumn: 'session_name', sortdirection: 'asc' };
August 12, 2015 at 12:43 pm in reply to: Sorting Throws Errors + Sorting Alphanumerics Sorting Throws Errors + Sorting Alphanumerics #74762Great, thank you for the clarification, those do not throw errors now. However, I don’t see in your demo a clear example of comparing “the values after ‘Foo-‘ only” for our one sortable column. Would truly appreciate any guidance you might be able to provide here. Thanks again.
-
AuthorPosts