Search code examples
ag-gridag-grid-react

ag-grid group cell renderer for expandable rows or full width cell renderer,


ag-grid group cell renderer is using ag-grid-enterprise dependency in the demo(https://www.ag-grid.com/javascript-grid-provided-renderer-group/),

does it mean it's enterprise feature or can we use it. If not I read here(Is there a way to group rows in ag-grid without the enterprise version?) ag-grid full width can be used for expand row feature, can someone help how to use full width for row expand?


Solution

  • I found the workaround.

    Ag-grid group cell renderer doesn't work without importing 'ag-grid-enterprise' dependency. So to implement the row expand feature with community version, I used full width cell renderer (https://www.ag-grid.com/javascript-grid-full-width-rows/).

    Steps: Let's assume on button click you want to expand that row. full width cell renderer have 'isFullWidthCell' function which tells weather to show the row in full width or not.

    So now, on button click you have to add a property to a rownode and return that property from 'isFullWidthCell' function. (I am adding new row as well on button click and for that row only setting that property)

    For example:

    function isFullWidthCell(rowNode) { return rowNode.data.isExpandable; } So if this property is true then it will expand that row.

    It might be confusing, But go through the documentation once, It might help.