Not an issue so much as a question. The documentation indicates you should return a value of 1, -1, or 0 in your custom sort function. http://docs.dhtmlx.com/grid__sorting.html
All the examples I see use ternary operators that return either 1 or -1. I’m looking for any example that uses ‘return 0’. In my code sample below, I added a ‘return 0’ in cases where the two parameters match. For large data sets (10,000+ records) that contain many duplicate records in the column being sorted, I see a significant speed improvement. If you don’t care about the order within a set of same valued records, is there any reason why ‘return 0’ should be avoided?
function sort_custom(a, b, order) {
if (a == b) { return 0; } // added this line
if (order == "asc") {
return (a > b ? 1: -1);
} else {
return (a < b ? 1: -1);
}
}