1

Is is possible to get a checkbox to appear for leaf nodes in row groups when the grid is configured to display multiple columns for the groups?

Plunker example: https://plnkr.co/edit/KlEOO7ro9WvlYHDU in this instance I want checkboxes to appear for the "Athlete" column but only when the leaf nodes are visible

checkboxes should appear in the highlighted area only

If I add 'checkboxSelection': true to the column definition then the checkbox is shown even when the group is collapsed: checkboxes are appearing on non-leaf rows/nodes


The AG Grid documentation has an example of nearly I want but that only works when all of the groups appear in a single column and the group column has a field assigned to it ahead of time https://www.ag-grid.com/javascript-data-grid/row-selection/#example-groups--checkbox-selection

enter image description here


I may be able to work around it with CSS or a custom renderer but I'd rather do it with configuration

1 Answers1

1

I found the solution, I can use the function form of checkboxSelection and inspect whether the current node is a group or not

checkboxSelection: (params) => !params.node.group;

Updated working plunker https://plnkr.co/edit/x38j1tDGuJoKIOUg

enter image description here

  • This helped me with the "opposite" need - I only wanted checkboxes on the group rows - and used this: checkboxSelection: (params) => params.node.group, – Ben in CA Mar 04 '22 at 22:12