Aggrid Question: How to hide Aggregation Prefix

Hi, I’m trying to display an aggrid using pivotMode and summarise my columns using aggFunc = “sum”.

The problem comes when I try to hide the “sum()” prefix from the column header.

I’ve tried using the suppressAggFuncInHeader = True option, but it doesn’t work. I have also tried using a custom aggFunc but nothing changes.

I would appreciate any suggestions on how to hide them. Thanks in advance!

@PablocFonseca Hi, first of all thanks for creating the component for Streamlit, it’s super useful! I mention you in case you know a solution for this, it would be very helpful.

        gb = GridOptionsBuilder()
        gb.configure_default_column(
            resizable=True,
            filterable=True,
            sortable=True,
            editable=False
        )
        
        gb.configure_column(field="nombre",
                            header_name="Nombre",
                            type="text",
                            filter=True,  
                            rowGroup=True  
                           )
        
        gb.configure_column(field="month",
                            header_name="Mes",
                            pivot=True)
        
        gb.configure_column(field="Ausencias",
                            header_name="Ausencias",
                            type=["numericColumn"],
                            aggFunc="sum", 
                            width = 150)
        
        gb.configure_column(field="Desasignado",
                            header_name="Desasignado",
                            type=["numericColumn"],
                            aggFunc="sum",
                            width = 150)
        
        gb.configure_column(field="Preventa",
                            header_name="Preventa",
                            type=["numericColumn"],
                            aggFunc="sum",
                            width = 150)
        
        gb.configure_column(field="Productiva",
                            header_name="Productiva",
                            type=["numericColumn"],
                            aggFunc="sum",
                            cellStyle={'color': 'green'},
                            width = 150)
    
        # Habilita el modo pivote
        gb.configure_grid_options(pivotMode=True,
                                  autoGroupColumnDef=dict(
                                  minWidth=100, 
                                  pinned="left", 
                                  cellRendererParams=dict(suppressCount=True),
                                  horizontalScrollShow= True,
                                  supressAggFuncInHeader = True     
                                ))
        
        go = gb.build()
1 Like

I did it!

Just adding:

gb.configure_grid_options(suppressAggFuncInHeader = True)

But in an isolated way. It works fine :ok_hand:

1 Like

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