如何在ag-grid-angular中扩展第一组级别 [英] How to expand the first group level in ag-grid-angular

查看:206
本文介绍了如何在ag-grid-angular中扩展第一组级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ag-grid,其中行默认情况下按两列分组,但是这些组已折叠。

I have an ag-grid where rows are grouped by two columns by default, but the groups are collapsed.

colDefs = 
[
  {
    field: 'colA',
    rowGroupIndex: 0,
  },
  {
    field: 'colB',
    rowGroupIndex: 1
  },
  …
];

我想像这样扩展第一个小组级别:

I would like to have the first group level expanded like this:

- ColA 1
  + COlB 1 (5)
  + ColB 2 (3)
- ColA 2
  + COlB 3 (1)
  + COlB 4 (9)
  + COlB 5 (11)

扩展第一级组的最佳位置在哪里?

Where is the best place to expand the first level groups?

推荐答案

看看我的朋克已创建: ag-grid:在ag-grid-angular中展开组

Have a look at the plunk I've created: ag-grid: expand groups in ag-grid-angular

this.gridApi.expandAll();

有关更多参考,请参阅文档:内置菜单项

For more reference, have a look at the documentation: Built In Menu Items


expandAll:展开所有组。仅在按至少一列分组时显示。

expandAll: Expand all groups. Only shown if grouping by at least one column.






更新:



以上几点扩展了所有级别的节点。以下解决方案是根据您的需要实现的。


Update:

The above point expands nodes at all levels. Below solution is to achieve as per what you need.

看看我创建的另一个插件: ag-grid:在ag-grid-angular中扩展第一组级别

Have a look at the another plunk I've created: ag-grid: expand the first group level in ag-grid-angular

我只是以编程方式扩展处于 0 级别的节点。

I am simply programmatically expanding the nodes which are at 0 level.

this.gridApi.forEachNode((node, b) => {
  if (node.level === 0) {
    node.setExpanded(true);
  }
});

这篇关于如何在ag-grid-angular中扩展第一组级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆