Is there a way to index number in KendoUI grid

918 views Asked by At

The below example adds an index number, but if you click in the various sorting columns (Contact Name, Company, Name, Country) the # doesn't update and it's not sortable. Is there a way to add the index number and have it sortable as well?

http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/Templates/add-row-numbers

1

There are 1 answers

0
himawan_r On

Actually the index there only an increment of the data, however if you create a custom field and assign index on parse at the data source you could do it. Something like this in that example (i add field index at parse time) :

schema: {
  parse: function(response) {
      for (var i = 0; i < response.d.results.length; i++) {
         response.d.results[i].index = i + 1;
      }
      return response;
  }
}

then just display the index like other field, here is an example in dojo.