primaryKey : stringDefault: undefined

Name of column that contains the record id.

If you set primary key, we assume that this number is unique for each records presented in the grid.
For example this should contains the column with primary key from your relation db table.
If the primaryKey is undefined, we autogenerate id for each record in the table by starting from 1.

Examples

defined

    
 <table id="grid"></table>
 <script>
     var 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' }
     ];
     $('#grid').grid({
         dataSource: data,
         primaryKey: 'ID',
         columns: [
             { field: 'ID', width: 70 },
             { field: 'Name' },
             { field: 'PlaceOfBirth' } ,
             { tmpl: '<a href="#">click me</a>', events: { click: function(e) { alert('Your id is ' + e.data.id); } }, width: 100, stopPropagation: true }
         ]
     });
 </script>

  

undefined

    
 <table id="grid"></table>
 <script>
     var 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' }
     ];
     $('#grid').grid({
         dataSource: data,
         columns: [
             { field: 'ID', width: 70 },
             { field: 'Name' },
             { field: 'PlaceOfBirth' } ,
             { tmpl: '<a href="#">click me</a>', events: { click: function(e) { alert('Your id is ' + e.data.id); } }, width: 100, stopPropagation: true }
         ]
     });
 </script>