Reputation: 829
I have a kendo grid i need to sort my column data using sortable:true
this property my data in three formats . while sorting it takes Upper case first and lower case letter second (like A B C a b c ....).
Any one knows the solution(I search this through many blogs but i can't)
Upvotes: 0
Views: 1581
Reputation: 1282
you can sort on DataSource. So you can add a hidden
field to DataSource and make it to lower case. Sort this hidden field.
Here is an example:
userNamen = [];
$.each(obj.users, function(i, el){
userNamen.push({ no: el.no,
name: el.ID,
email: el.email,
fax: el.faxDirect,
phone: el.phoneDirect,
toLowerCase: el.ID.toLowerCase()
});
})
$("##callTo").data("kendoDropDownList").setDataSource(userNamen);
$("##callTo").data("kendoDropDownList").dataSource.sort({ field: "toLowerCase",
dir: "asc" });
Upvotes: 0
Reputation: 18402
Here's a solution which replaces the comparer used by the datasource:
https://gist.github.com/JohannesHoppe/4161255
And here's the relevant thread I got that link from (that's also where Sankar's solution is from): http://www.kendoui.com/forums/kendo-ui-web/grid/how-to-enable-case-insensitive-sorting-on-kendo-ui-grid.aspx
(note that case-insensitive sorting is apparently implemented in newer versions of Kendo UI, so you might just want to upgrade)
Upvotes: 1