简体   繁体   English

RowGroup中的AG网格单选

[英]AG-Grid Single Selection Within RowGroup

I was wondering if it was possible to replicate AG-Grids's single selection within a rowGroup? 我想知道是否可以在rowGroup中复制AG-Grids的单个选择?

For example, If I had multiple rows within a group that are selectable, I want to be able to select a row within that group and have it automatically deselect the previously selected row. 例如,如果我在一个组中有多个行是可选的,那么我希望能够在该组中选择一个行,并使其自动取消选择先前选择的行。 Mimicking the single selection. 模仿单个选择。

在此处输入图片说明

Any help or insight would be greatly appreciated! 任何帮助或见识将不胜感激! Thank you! 谢谢!

I'm not sure if there is something inbuilt (would be ideal) but you could achieve it programmatically by deselecting other siblings on rowSelection event: 我不确定是否有内置的东西(会很理想),但是您可以通过在rowSelection事件上取消选择其他同级来以编程方式实现它:

onRowSelected = event => {
  if (event.node.selected) {
    event.node.parent.childrenAfterFilter
      .filter(childNode => childNode.id !== event.node.id)
      .forEach(node => node.setSelected(false));
  }
}

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

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