getByIdReturns: object

Return record by id of the record.

Parameters

NameTypeDescription
id {string} The id of the row that needs to be returned.

Examples

sample

    
 <button id="btnGetData" class="gj-button-md">Get Data</button>
 <br/><br/>
 <table id="grid"></table>
 <script>
     var grid = $('#grid').grid({
         dataSource: '/Players/Get',
         columns: [ { field: 'ID', width: 56 }, { 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>