ski760
ski760

Reputation: 151

Is there a way to index number in KendoUI grid

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

Upvotes: 0

Views: 939

Answers (1)

himawan_r
himawan_r

Reputation: 1780

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.

Upvotes: 0

Related Questions