I have a jQgrid column which would show data as in the below example.
- 5 of 10
- 2 of 2
- 5 of 5
- 2 of 10…. etc
I wanna implement a custom sorting which would sort first based on the number before ‘of’ and then for duplicates it should use the number after the ‘of’.
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
- 2 of 2
- 2 of 10
- 5 of 5
- 5 of 10
Thanks in advance.
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