getSelectionsReturns: array

Return an array with the ids of the selected record.

Specify primaryKey if you want to use field from the dataSource as identificator for selection.

Examples

With Primary Ket

    
 <button id="btnShowSelection" class="gj-button-md">Show Selections</button>
 <br/><br/>
 <table id="grid"></table>
 <script>
     var grid, data = [
         { 'ID': 101, 'Name': 'Hristo Stoichkov', 'PlaceOfBirth': 'Plovdiv, Bulgaria' },
         { 'ID': 102, 'Name': 'Ronaldo Luis Nazario de Lima', 'PlaceOfBirth': 'Rio de Janeiro, Brazil' },
         { 'ID': 103, 'Name': 'David Platt', 'PlaceOfBirth': 'Chadderton, Lancashire, England' },
         { 'ID': 104, 'Name': 'Manuel Neuer', 'PlaceOfBirth': 'Gelsenkirchen, West Germany' }
     ];
     grid = $('#grid').grid({
         dataSource: data,
         primaryKey: 'ID',
         columns: [ { field: 'ID', width: 70 }, { field: 'Name' }, { field: 'PlaceOfBirth' } ],
         selectionMethod: 'checkbox',
         selectionType: 'multiple',
         pager: { limit: 2, sizes: [2, 5, 10, 20] }
     });
     $('#btnShowSelection').on('click', function () {
         var selections = grid.getSelections();
         alert(selections.join());
     });
 </script>

  

Without Primary Ket

    
 <button id="btnShowSelection" class="gj-button-md">Show Selections</button>
 <br/><br/>
 <table id="grid"></table>
 <script>
     var grid, data = [
         { 'ID': 101, 'Name': 'Hristo Stoichkov', 'PlaceOfBirth': 'Plovdiv, Bulgaria' },
         { 'ID': 102, 'Name': 'Ronaldo Luis Nazario de Lima', 'PlaceOfBirth': 'Rio de Janeiro, Brazil' },
         { 'ID': 103, 'Name': 'David Platt', 'PlaceOfBirth': 'Chadderton, Lancashire, England' },
         { 'ID': 104, 'Name': 'Manuel Neuer', 'PlaceOfBirth': 'Gelsenkirchen, West Germany' }
     ];
     grid = $('#grid').grid({
         dataSource: data,
         columns: [ { field: 'ID', width: 70 }, { field: 'Name' }, { field: 'PlaceOfBirth' } ],
         selectionMethod: 'checkbox',
         selectionType: 'multiple',
         pager: { limit: 2, sizes: [2, 5, 10, 20] }
     });
     $('#btnShowSelection').on('click', function () {
         var selections = grid.getSelections();
         alert(selections.join());
     });
 </script>