How to add row number to kendo ui grid?

前端 未结 8 1390
花落未央
花落未央 2020-12-15 09:35

I have a kendo ui grid in my page that has some columns. Now I want to add a column to it that shows me row number. How to I do this? Thanks.

8条回答
  •  悲&欢浪女
    2020-12-15 10:14

    Declare a variable for row counting:

    var rowNumber = 0;
    

    Use it in your template with ++ operator to increment it for each iteration:

    #= ++rowNumber #
    

    This also works for Kendo UI ListView.

    See the official document:

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

提交回复
热议问题