Return record by id of the record.
Parameters
Name | Type | Description |
---|---|---|
id | {string} | The id of the row that needs to be returned. |
Examples
sample
<button id="btnGetData">Get Data</button>
<br/><br/>
<table id="grid"></table>
<script>
var grid = $('#grid').grid({
dataSource: '/0_6/Grid/GetPlayers',
columns: [ { field: 'ID' }, { field: 'Name' }, { field: 'PlaceOfBirth' } ],
primaryKey: '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>