简体   繁体   中英

AG-Grid Single Selection Within RowGroup

I was wondering if it was possible to replicate AG-Grids's single selection within a rowGroup?

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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