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

Sort Kendo UI grid by Checkbox status?

1 Answer 157 Views
Grid
This is a migrated thread and some comments may be shown as answers.
X
Top achievements
Rank 1
X asked on 16 Apr 2016, 06:53 PM
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?


Thanks

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 19 Apr 2016, 03:24 PM
Hi,

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.


Regards,
Konstantin Dikov
Telerik
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
Tags
Grid
Asked by
X
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or