AG Grid Gridbuilder to create column groups

I am trying to build a budget grid in streamlit using AG Grid, something like the one below. I am able to do this building my own grid options like below:

    columnDefs = [
        {
            'headerName': 'Vessel',
            'headerClass': 'custom-header',
            'children': [
                {'field': 'vessel_name', 'headerName': 'Vessel Name', 'cellClass': 'custom-cell-description', 'headerClass': 'custom-header custom-subheader'},
                {'field': 'segment', 'headerName': 'Segment', 'cellClass': 'custom-cell-description', 'headerClass': 'custom-header custom-subheader'},
            ]
        },
        {
            'headerName': 'TOTAL BUDGET',
            'headerClass': 'custom-header custom-header-opex',
            'children': [
                {'field': 'annual_budget'},
            ]
        }
    ]

    # Initialize grid options with column definitions
    gridOptions = {
        'columnDefs': columnDefs
    }

But this ends up having a LOT of repetitive code since it’s all in a dict, and i have many more groups. Is there anyway to achieve this parent/child AG Grid options using the Gridbuilder tool?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.