getById Returns: object
Return record by id of the record.
Parameters
Name | Type | Description |
---|---|---|
id | {string} | The id of the row that needs to be returned. |
Examples
<button id="btnGetData">Get Data</button>
<br/><br/>
<table id="grid"></table>
<script>
var grid = $("#grid").grid({
dataSource: "../Grid/GetPlayers",
columns: [ { field: "ID" }, { field: "Name" }, { field: "PlaceOfBirth" } ],
dataKey: "ID" //define the name of the column that you want to use as ID here.
});
$("#btnGetData").on("click", function () {
var data = grid.getById("2");
alert(data.Name + " born in " + data.PlaceOfBirth);
});
</script>