I am trying to enforce a custom sortable compare function for some columns in a Kendo Grid, specifically some currency values that can be negative, null, 0, or positive. I am seeing inconsistent sorting across browsers and so tried to put a break point or an alert into the custom sortable object's function, but neither is being hit.
Here is an example of the setup for the Salary column. The Salary field is setup as type number.
{
field: "Salary",
format: "{0:c2}",
sortable: {
compare: function (a, b) {
x = kendo.parseFloat(a);
y = kendo.parseFloat(b);
if (isNaN(x) || x === null) {
x = 0;
}
if (isNaN(y) || y === null) {
y = 0;
}
alert('x = ' + x + '; ' + 'y = ' + y);
return (x === y ? 0 : ((x > y) ? 1 : -1));
}
}
}
I have a JSFiddle all set up to demonstrate this behavior located here.
This question does not provide an answer.
Thanks.