This is a migrated thread and some comments may be shown as answers.

Client-side Sorting of Template Columns Bound to Object

1 Answer 295 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 09 Mar 2015, 05:10 PM
I am passing an IEnumerable of viewmodels to the grid at load time.  My columns are bound to properties on the viewmodels, which are themselves different viewmodels.  Since I am not reading the data via AJAX, I would like to have the data sorted on the client-side.  I have .Sortable() called on the grid and .ServerOperation(false) called on the DataSource.  When I mouse over the column header, my browser displays a URL like: http://mysite/controller/action?gridName-sort=ColumnName-asc  When I click on the column header, the sort arrow appears, changes, or disappears, but the data is not reordered.  I tried implementing IComparable and IComparable<T> on my column viewmodel on a suggestion from another user, but this does not appear to work.  Can client-side sorting work in this scenario?  If so, what do I need to do?

Thanks,
Brian

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 11 Mar 2015, 02:56 PM

Hello Brian,

You can try implementing the custom compare function for client side, sorting. The relevant documentation is here, please check it out and let me know if it helps:

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columns.sortable.compare

Regards,
Kiril Nikolov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Brian
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or