rows selected is losed when search

Hi,

I need to select some rows, but when I've a lot of data, I need search the rows to select.

The problem is, when I select a row, if I search for a new row, I lose the previously selected row.

I attach an example.

Thanks

Attachment: SelectionProblem_78145a5e.zip

1 Reply

PK Prasanna Kumar Viswanathan Syncfusion Team September 6, 2018 05:16 AM UTC

Hi Manolo, 

Thanks for contacting Syncfusion support. 

To maintain the selection of the records even after searching for the values we suggest you to define the field value for the checkbox column. Please refer the below code example. 


@(Html.EJ().Grid<object>("FlatGrid") 
         .Datasource((IEnumerable<object>)ViewBag.datasource)         
        .AllowScrolling() 
         .AllowSorting()    /*Sorting Enabled*/ 
         .AllowPaging()    /*Paging Enabled*/ 
         .AllowSearching() 
            .SelectionType(SelectionType.Multiple) 
             
              .ToolbarSettings(toolbar => 
                { 
                 toolbar.ShowToolbar().ToolbarItems(items => 
                 { 
                     items.AddTool(ToolBarItems.Search); 
                }); 
              }) 
         .Locale("es-ES") 
        .Columns(col => 
        { 
            col.Type("checkbox").Field("Select").Width(50).Add(); 
            col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add(); 
            col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add(); 


For your convenience we have modified the provided sample with the mentioned changes and please download the sample from the following link 


Regards, 
Prasanna Kumar N.S.V 
 


Loader.
Up arrow icon