Sort Kendo UI grid by Checkbox status?

2 posts, 0 answers
  1. X
    X avatar
    1 posts
    Member since:
    Apr 2016

    Posted 16 Apr 2016 Link to this post

    I'm using Kendo grid in a MVC project. The first column is a checkbox which defines by ClientTemplate:

        .Columns(columns =>
                columns.Bound(c => c.Checked).ClientTemplate(@"<input type='checkbox' class='checkbox' />").Width(50).Title("");
                columns.Bound(c => c.Id).Hidden();
                columns.Bound(c => c.FirstName);
                columns.Bound(c => c.LastName);
                columns.Bound(c => c.Company);  
    What I want to have is: before click the header, it looks like the 1st screen shot. then make changes to the checkbox, click the header again, it will sort the row by the checkbox status, see screen shot 2.

    I tried to set the 1st column sortable, but all others not sortable. Still not works. I think it is because when the data binds to the grid, c.Checked is always false. Now, if we click the checkbox, it does not change the value of that. That's why the sort does not work for this column.

    How to make this work?


  2. Konstantin Dikov
    Konstantin Dikov avatar
    2115 posts

    Posted 19 Apr 2016 Link to this post


    In order to achieve the desired result you will have to save the changes to your Checked field and then apply the sort expression. Note that the filtering, sorting, grouping, etc., are performed based on the data source values.

    For enabling the editing for your Grid you could refer to the following online demos:
    Hope this helps.

    Konstantin Dikov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top