Reputation: 3078
I have a jQgrid column which would show data as in the below example.
I have implemented the main sort using the following function.
sorttype: function (cellValue, cellObject) {
var sortValueArr = cellValue.split(" ");
return parseInt(sortValueArr[0]);
//return [parseInt(sortValueArr[0]), parseInt(sortValueArr[2])];
}
But am stuck up implementing the secondary-sort-for-duplicates. I tried it with the commented line above. But it is not working.
Please help me out.
The output required is
Thanks in advance.
Upvotes: 0
Views: 321
Reputation: 2111
Well, it's not a pretty answer, but you if you know a hard maximum for the second number, you can run it as a float. For example, if you can be sure that the second number won't get above, say, 1000, you might use the following
sorttype: function (cellValue, cellObject)
{
var sortValueArr = cellValue.split(" ");
return (parseFloat(sortValueArr[0]) + parseFloat(sortValueArr[2])/1000);
}
Upvotes: 1