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 select a row in a grid, on load of grid data.

Hi,

How can i select a row in a grid on onload of grid data and how to trigger the click event after row selection.

Is there any way to store grid layout info and set the stored layout on onload of the data?

Thanks 
Surya

1 Reply

MS Mani Sankar Durai Syncfusion Team July 25, 2017 10:23 AM UTC

Hi Surya, 

Thanks for contacting Syncfusion support. 

Query 1: How can i select a row in a grid on onload of grid data and how to trigger the click event after row selection.  
          We have analyzed your query and to select the rows on load time we suggest you to use selectRows method inside the dataBound event of grid or using selectedRowIndex property in grid. 
Refer the code example 
  $("#Grid").ejGrid({ 
                // the datasource "window.gridData" is referred from jsondata.min.js 
                dataSource: window.gridData, 
                allowPaging:true, 
                columns: [ 
... 
                ], 
                dataBound: function (args) { 
                    var grid = $("#Grid").ejGrid("instance"); 
                    grid.selectRows(1); 
                }, 
                
            }); 

Refer the documentation link 


Also to trigger the click event after the row selection in grid we suggest you to use the following events in grid. 
recordClick: triggers when record is clicked in grid. 
rowSelected: triggers after rows selected in grid. 
Refer the documentation link. 


Query 2: Is there any way to store grid layout info and set the stored layout on onload of the data? 
 
We suspect that you would like to maintain the grid state even if it refresh. So we suggest you to use enablePersistence property in grid which helps to maintain the grid event the page gets refreshed. 
Refer the documentation link. 

Also we have documented a knowledge base by saving the model values in database and it can be available from the below link. 



Please let us know if you need further assistance 

Regards, 
Manisankar Durai. 
 



Loader.
Live Chat Icon For mobile
Up arrow icon