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

Grid control features

looking at the grid control and i am wondering about the following features

programmatically setting the current row
i see how you can select rows but i am not sure if i can change the current row (similar to the user clicking on a row)

programmatically going to the top and bottom of the grid

thanks

Mike


3 Replies

JK Jayaprakash Kamaraj Syncfusion Team November 10, 2016 01:25 PM UTC

Hi Michael, 
 
Thank you for contacting Syncfusion support. 
 
We can select the grid rows using selectRows method based on the index. We can get the row index based on the given tr element in grid using getIndexByRow() method. Please refer to the below help documents and code example. 
 
Help document for, 
 
 
 
    <script> 
// Create grid object. 
        var gridObj = $("#Grid").data("ejGrid"); 
       var index =  gridObj.getIndexByRow($(".e-gridcontent tr").first()); // here we will get index 
       gridObj.selectRows(index); // Selects rows based on the given index 
    </script> 
 
Regards, 

Jayaprakash K. 



MS Michael Salzlechner November 10, 2016 02:04 PM UTC

thanks

i tried as documented

gridObj.selectRows(fromindex, toindex);

gridObj.selectRows(1,1);

and this does not work. 

gridObj.selectRows(1);

however does work



JK Jayaprakash Kamaraj Syncfusion Team November 11, 2016 10:00 AM UTC

 
Hi Michael, 
 
If you want to select multiple rows in grid, we need to set selectionType as multiple in Grid . Please refer to the below help documents, code example and sample.   

Help document for, 




$(function () { 
            $("#Grid").ejGrid({ 
                // the datasource "window.gridData" is referred from jsondata.min.js 
                dataSource: window.gridData, 
                allowPaging: true, 
                selectionType: "multiple", 
.. 
                columns: [ 
.. 
                ] 
            }); 
        $("#refresh").click(function () { 
            var obj = $("#Grid").ejGrid("instance"); 
            obj.selectRows(1, 4); 
 
        }); 



Regards, 
 
Jayaprakash K. 


Loader.
Live Chat Icon For mobile
Up arrow icon