Deselect selected row

Hello,
I've searched threads in the forum but I couldn't find a solution.
How to deselect selected row/s in a grid?

3 Replies

PK Prasanna Kumar Viswanathan Syncfusion Team August 3, 2018 11:42 AM UTC

Hi Boryana, 
 
Thanks for contacting Syncfusion support. 
 
We can achieve your requirement using the enableToggle property of selectionSettings API in ejGrid. In this case we can select/deselect the record in a single click on it. 

Refer the below code example. 


@(Html.EJ().Grid<OrdersView>("FlatGrid") 
        .Datasource((IEnumerable<object>)ViewBag.datasource) 
         
        .AllowSelection() 
        .SelectionSettings(ss => ss.EnableToggle(true)) 
         
         ---- 
 
) 



If you want to clear selection in programmatically then we suggest you to call the clearSelection method of ejGrid control. 

In the below code example we have clear the selection using an external button click event. 


<input type="button" value="ClearSelectionInGrid" onclick="ClearingTheSelectionINGrind()" /> 
 
@(Html.EJ().Grid<OrdersView>("FlatGrid") 
        .Datasource((IEnumerable<object>)ViewBag.datasource) 
         
        .AllowSelection() 
 
         ---         
 
           .Columns(col => 
            { 
                 
                --- 
 
           }) 
) 
 
<script type="text/javascript"> 
 
    function ClearingTheSelectionINGrind(args) { 
 
        var gridObj = $("#FlatGrid").ejGrid('instance'); 
        gridObj.clearSelection(); 
 
    } 
 
</script> 

                                                                                                                                                   
We have prepared a sample and it can be downloadable from the below location. 


Refer the help documentation. 


 
Regards, 
Prasanna Kumar N.S.V 



BP Boryana Panayotova August 8, 2018 08:58 AM UTC

Thank you very much


PK Prasanna Kumar Viswanathan Syncfusion Team August 9, 2018 04:49 AM UTC

Hi Boryana, 

We are happy to hear that your issue has been solved.  

Please get back to us if you need any further assistance. 

Regards, 
Prasanna Kumar N.S.V 


Loader.
Up arrow icon