RowGroup内的AG-Grid单选

AG-Grid Single Selection Within RowGroup

我想知道是否可以在 rowGroup 中复制 AG-Grids 的单个 selection?

例如,如果我在一个组中有多行 selectable,我希望能够 select 该组中的一行并让它自动取消 select 之前 selected 行。模仿单个 selection.

任何帮助或见解将不胜感激!谢谢!

我不确定是否有内置的东西(这将是理想的),但您可以通过在 rowSelection 事件中取消选择其他兄弟姐妹来以编程方式实现它:

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