Grid paging counts do not properly update when dynamically adding/removing rows
#5,492 创建于 2016年6月23日
仓库指标
- Star
- (5,395 star)
- PR 合并指标
- (30 天内没有已合并 PR)
描述
There are tutorials on how to dynamically add and remove rows from a grid, each revolving around updating the 'data' array in grid options. This works beautifully for including new rows of data, or removing rows, without having to make additional requests of the server to 'reload' the grid. The only issue is that pagination counts are not updated when changes are made.
For instance, if I have a grid with a total count of 55 records, and I'm displaying items 1 to 25, and I remove a row, then I would expect the total count to be decremented by 1, and the display to now say I'm viewing items 1 to 24. Now, in my method where I remove the array element from data I can also update my options.totalItems easily (manually), but that still doesn't update the '1 or 25' count. Currently that count uses $scope.showingHigh, which is based on a calculation. I can't provide a new value for this without hacking the component, or by changing the paginationPageSize (which would then trigger a reload of the grid). Perhaps the calculation could be changed to use the array length, rather than the paginationPageSize? I know that would be problematic when also doing client side filtering, so I'm not entirely sure of the logic needed...