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
SIGN IN To post a reply.
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,
selectRows method : https://help.syncfusion.com/api/js/ejgrid#methods:selectrows
getIndexByRow method: https://help.syncfusion.com/api/js/ejgrid#methods:getindexbyrow
|
<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,
Selection : https://help.syncfusion.com/js/grid/selection
|
$(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);
}); |
Online demo sample: http://js.syncfusion.com/demos/web/#!/bootstrap/grid/selection/basic
Regards,
Jayaprakash K.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
MS Michael Salzlechner
- Nov 9, 2016 09:05 PM UTC
- Nov 11, 2016 10:00 AM UTC