I would like to include the row number of the sorted and filtered dataset in Smart Table as a separate column.
我想将Smart Table中已排序和过滤的数据集的行号作为单独的列包含在内。
As long as I do not use paging I can simply use the $index propery of angular's ng-repeat but this does not work where paging is enabled since $index starts on 0 for each page.
只要我不使用分页,我就可以简单地使用angular的ng-repeat的$ index属性,但这在启用分页的情况下不起作用,因为每个页面的$ index从0开始。
Anyone have any ideas on how to accomplish this?
任何人对如何实现这一点有任何想法?
2 个解决方案
#1
3
I found a way to do this:
我找到了一种方法:
- Adding the following to the controller
- 将以下内容添加到控制器
$scope.page_size = 100
$scope.current_page = 1
$scope.rembemberCurrentPage = function(p) {
$scope.current_page = p
}
- Adding the following to the template
- 将以下内容添加到模板中
<div st-pagination
st-page-change="rembemberCurrentPage(newPage)"
st-items-by-page="page_size">
</div>
3. Row number can then be accessed on the form
3.然后可以在表单*问行号
td ng-bind="((current_page-1)*page_size)+$index+1"></td>
I figured it out through this post: https://github.com/lorenzofox3/Smart-Table/issues/438
我通过这篇文章想出来:https://github.com/lorenzofox3/Smart-Table/issues/438
#2
2
<td ng-bind="pageNum*pageSize + $index"></td>
#1
3
I found a way to do this:
我找到了一种方法:
- Adding the following to the controller
- 将以下内容添加到控制器
$scope.page_size = 100
$scope.current_page = 1
$scope.rembemberCurrentPage = function(p) {
$scope.current_page = p
}
- Adding the following to the template
- 将以下内容添加到模板中
<div st-pagination
st-page-change="rembemberCurrentPage(newPage)"
st-items-by-page="page_size">
</div>
3. Row number can then be accessed on the form
3.然后可以在表单*问行号
td ng-bind="((current_page-1)*page_size)+$index+1"></td>
I figured it out through this post: https://github.com/lorenzofox3/Smart-Table/issues/438
我通过这篇文章想出来:https://github.com/lorenzofox3/Smart-Table/issues/438
#2
2
<td ng-bind="pageNum*pageSize + $index"></td>