angular-ui/ui-grid

suggestion: grouping: select all lines in a group at once

Open

#4,122 创建于 2015年8月5日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)JavaScript (2,496 fork)batch import
help wantedtype: enhancement

仓库指标

Star
 (5,395 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

It would be great if the code in the example 320 complex grouping was integrated as a feature. I think it is a natural option to be used by the user.

$scope.gridApi.selection.on.rowSelectionChanged( $scope, function ( rowChanged ) {
    if ( typeof(rowChanged.treeLevel) !== 'undefined' && rowChanged.treeLevel > -1 ) {
      // this is a group header
      children = $scope.gridApi.treeBase.getRowChildren( rowChanged );
      children.forEach( function ( child ) {
        if ( rowChanged.isSelected ) {
          $scope.gridApi.selection.selectRow( child.entity );
        } else {
          $scope.gridApi.selection.unSelectRow( child.entity );
        }
      });
    }
  });

Thanks

贡献者指南