Checkbox deselects on action

Hi I have a grid, with a checkbox column, if I enable filtering and or grouping, and I have some rows selected, when I filter or group, the selected rows deselect automatically.

            <SfGrid AllowPaging="true" AllowFiltering="true" @ref="Grid" AllowSelection="true" DataSource="@WSOrders">
                <GridSelectionSettings Type="SelectionType.Multiple"></GridSelectionSettings>
                <GridPageSettings PageSize="10"></GridPageSettings>
                <GridEvents TValue="mySDK.WSOrder" RowDeselected="GetDeselectedRows" RowSelected="GetSelectedRows"></GridEvents>
                <GridColumns>
                    <GridColumn Type="ColumnType.CheckBox" Width="50"></GridColumn>
                    <GridColumn Field="@nameof(WSOIJ.WSOrderID)" HeaderText="Id"></GridColumn>
                </GridColumns>
            </SfGrid>

1 Reply 1 reply marked as answer

JP Jeevakanth Palaniappan Syncfusion Team August 19, 2020 07:47 AM UTC

Hi Raul, 
 
We have validated your query and by default, the selection will be removed while performing any action in the grid. But you can achieve your requirement by enabling the PersistSelection property of GridSelectionSettings. For this, any one of the columns must be enabled with IsPrimaryKey as true. Please refer the below code snippet for your reference. 

<SfGrid DataSource="@Orders"> 
<GridSelectionSettings PersistSelection="true"></GridSelectionSettings> 
    <GridColumns> 
        <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
    </GridColumns> 
</SfGrid> 

Please get back to us if you need further assistance. 

Regards, 
Jeevakanth SP 


Marked as answer
Loader.
Up arrow icon