Client-side Sorting of Template Columns Bound to Object

2 posts, 0 answers
  1. Brian
    Brian avatar
    58 posts
    Member since:
    Jul 2011

    Posted 09 Mar 2015 Link to this post

    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
  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2596 posts

    Posted 11 Mar 2015 Link to this post

    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.

     
Back to Top