페이징 없는 경우
columns: [
{ title: "No", width: "50px", attributes : { style : "text-align : center; " }, template: "<span class='row-number'></span>" },
dataBound : function() {
var rows = this.items();
$(rows).each(function () {
var index = $("#grid2").data("kendoGrid").dataSource.total() - $(this).index();
var rowLabel = $(this).find(".row-number");
$(rowLabel).html(index);
});
}
페이지 있는 경우
columns: [
{ title: "No", width: "50px", attributes : { style : "text-align : center; " }, template: "<span class='row-number'></span>" },
dataBound : function() {
var rows = this.items();
$(rows).each(function () {
var index = ($("#gridDetail").data("kendoGrid").dataSource.total() - $(this).index()) - ($("#gridDetail").data("kendoGrid").dataSource.pageSize() * ($("#gridDetail").data("kendoGrid").dataSource.page() - 1));
var rowLabel = $(this).find(".row-number");
$(rowLabel).html(index);
});
}