I have kendo grid in asp.net mvc and i use server wrapper.I want Additional column named \"Row Number\" that is simple counter (1,2,3,...). I want this counter never change
Other answers are OK but they don't apply pagination effects. So I think better implementation would be:
var grid = $( "#grid" ).kendoGrid( {
sortable: true,
dataSource: [ {
name: "Jane Doe",
age: 30
}, {
name: "John Doe",
age: 33
} ],
pageable: {
refresh: false,
pageSizes: true,
pageSize: 10,
},
columns: [ {
field: "name"
}, {
field: "age"
}, {
field: "rowNumber",
title: "Row number",
template: dataItem => grid.dataSource.indexOf(dataItem) + 1
} ],
} ).data().kendoGrid;