简体   繁体   English

Angular UI Grid-基于过滤器全选

[英]Angular UI Grid - select all based on filter

I am currently using ui-grid and have run into a small problem. 我目前正在使用ui-grid,遇到了一个小问题。 I want to be able to select all the items based on filters I have set within the grid. 我希望能够根据我在网格中设置的过滤器select all项目。 For example, if I do a select all without a filter, 500 items will be selected. 例如,如果我不select all过滤器进行全选,则会选择500个项目。 Then, if I filter a column and select all , 500 items are again selected instead of the items that are currently being shown. 然后,如果我过滤一列并select all ,那么将再次选择500个项目,而不是当前显示的项目。

My select all logic is very simple per the ui-grid documentation: 根据ui-grid文档,我的全选逻辑非常简单:

$scope.selectAll = function () {
    $scope.gridApi.selection.selectAllRows();
};

$scope.clearAll = function () {
    $scope.gridApi.selection.clearSelectedRows();
};

The reason I want this is because I'm working on a mass delete - the ability to filter down the grid to items you can then delete simply by clicking select all and then delete . 我想要这样做的原因是因为我正在进行批量删除-能够将网格筛选为可以通过单击全select all然后删除的项目进行delete

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM