How to get row index in angular ui-grid 3.0

后端 未结 6 735
执念已碎
执念已碎 2020-12-31 10:32

I\'m working with angular ui-grid version 3.0 and can not find the way to get the index of the row, to add a numeration column to the grid. I would like to help me.

6条回答
  •  臣服心动
    2020-12-31 11:33

    the problem of first solution is that it does not work properly whith pagination. the celltemplate of index column must be something like this to have the right index on each page and not to begin from 1 on each page :

    { field: 'index', displayName: 'Index', width: '50', cellTemplate: '
    {{grid.renderContainers.body.visibleRowCache.indexOf(row)+(grid.options.paginationPageSize*(grid.options.paginationCurrentPage-1))+1}}
    ' }

    this solution would work even for client-side pagination or for server-side pagination

提交回复
热议问题