We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to keep checkbox position when sorting columns


When using a grid with checkboxes, how can we persist the checkbox for the item when sorting columns?

For example, a datagrid has three items: A, B and C.

When the user ticks the checkbox for C and then sorts the grid in descending order by clicking on a column header (i.e., by name), the checkbox is still checked in the 3rd row, but the grid now shows A as being selected, because the grid now displays C, B and A (after the descending sort order).

For a concrete example, you can use this example: https://ej2.syncfusion.com/aspnetcore/Grid/GridOverview#/material. Select the checkbox for the first item, then sort by a column...you will notice that the first item is still checked, but not for the correct value.


2 Replies

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team November 27, 2019 12:39 PM UTC

Hi Brian,

Usually, checkbox selection with the persistSelection property must be works with data presence in the Grid. But in this case, it is misbehaving. We are validating the problem at our end and we will update you further details in two business days.

Seeni Sakthi Kumar S 

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team November 29, 2019 08:36 AM UTC

Hi Brian, 

Thanks for your patient. 

We have checked your query at our end. By default, checkbox selection is maintaining depends upon the primary key. Please refer to the below sample. 

But for this case, we suspect you are using checkbox selection with enabling virtualization property. So we validated and confirmed it is not feasible for our current grid architecture’s limitations. Please refer to the below limitation link for more information. 

Seeni Sakthi Kumar S 

Live Chat Icon For mobile
Up arrow icon