我正在使用角度智能表来搜索和排序我的表格以及分页。
另外我使用angular xeditable模块来编辑行并添加新行等。
点击"添加行",我可以在表格中添加新行。 但是,由于启用了分页,有时用户可能在第2页或第3页。现在,如果用户点击"添加行"。 如何启用当前页面以显示第1页,因为这是显示新添加的可编辑行的位置
目前,如果用户在第2页上,并且他点击了"添加行"按钮,页面仍然是2.我希望页面移动到1。
这是指向我代码的指针 http://plnkr.co/edit/SxcdTGK2vsiDDJyjqanK?p=preview
//html snippet:
<div ng-controller="EditableRowCtrl">
<table st-table="display" st-safe-src="users" class="table table-bordered table-hover table-condensed">
...
<tr ng-repeat="user in display">
...
<tfoot>
<tr>
<td colspan="4" class="text-center">
<div st-pagination="" st-items-by-page="3"></div>
</td>
</tr>
</tfoot>
....
//javascript section:
$scope.addUser = function() {
$scope.inserted = {
id: $scope.users.length+1,
name: '',
status: null,
group: null
};
$scope.users.unshift($scope.inserted);
// Need to display page 1
};