Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AG Grid: checkboxes for leaf nodes when using row groups and multiple auto columns

Tags:

ag-grid

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

like image 527
Richard Misiak Avatar asked Sep 02 '25 15:09

Richard Misiak


1 Answers

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

like image 120
Richard Misiak Avatar answered Sep 05 '25 14:09

Richard Misiak