In Kendo grid, I wanted to show set of rows on top always. I am doing this based on an 'GroupField(values 1,2)' field and each group having different coloring pattern. On sorting, records need to sort in this group. I am able to sort among this group but the problem is last group is coming first.
In column definition i am calling a function in sortable block as shown below, function definition is also shown.
sortable: {
compare : function (a, b) {
return generateCompare(a, b, 'FieldNameToSort');
}
function generateCompare(a, b, field) {
if (a.GroupField == b.GroupField)
result = a[field] === b[field] ? 0: a[field]> b[field] ? 1 : -1;
else if (a.GroupField > b.GroupField)
result = -1;
}
Am I doing in the right way to get it done or is there any issue in my sort logic?