Working with agMultiColumnFilter

(using version 2.4.0)

I’m trying to figure out how to get a column filter that works like Excel, where I get a list of checkboxes for filtering the content.

Based on reading, it seems like agMultiColumnFilter is what I want, but it isn’t work the way I expect.

I built a minimal example using the sample data set at

https://raw.githubusercontent.com/plotly/datasets/master/ag-grid/olympic-winners.csv

Here is the relevant code and an image of what I’m getting in the filter.

Can someone tell me how to accomplish my intention here?

def generateTable(table, tableid, fixedColumnIndex=0, tableHeight=None, doFilter=False):

columnTypes = {
    "numberColumn": {"width": 130, "filter": "agNumberColumnFilter"},
    "medalColumn": {"width": 100, "columnGroupShow": "open", "filter": False},
    "nonEditableColumn": {"editable": False},
    "editableColumn": {"editable": True}
}

columns = []
columnIndex = 1
for i in table.columns:
    entry = {'headerName': i, 'field': i}
    entry['minWidth'] = 110
    entry['type'] = 'editableColumn'

   if i == 'year':
        entry['filter'] = 'agMultiColumnFilter'

    columns.append(entry)
table = table.to_dict('records')

defaultColDef = {
    "resizable": True,
    "sortable": True,
    "editable": False,
    "tooltipComponent": "CustomTooltip"
    }

dashGridOptions = {
    "undoRedoCellEditing": True, 
    "rowSelection": "single", 
    "columnTypes": columnTypes,
    "tooltipShowDelay": 400
    }

return dag.AgGrid(
    id=tableid,
    columnDefs=columns,
    rowData=table,
    columnSize="sizeToFit",
    defaultColDef=defaultColDef,
    dashGridOptions=dashGridOptions,
    className="ag-theme-balham",
    style=style
)

Hi @zack_nc

The agMultiColumnFilter is an AG Grid Enterprise feature. If you have Enterprise, you can start with the examples in the Dash Docs of the AG Grid Set Filter. The agMiltiColumnFilter has not yet made it into the Dash Docs , but if you need an example, please let me know.

1 Like

Thanks!

I see (JavaScript Data Grid: Community and Enterprise) that there is a free trial option for enterprise, but all of the instructions are specific to javascript.

Can you point me at instructions for trying the enterprise version for python?

Hi @zack_nc

To try the Enterprise version just set:

dag.AgGrid(
    enableEnterpriseModules=True,
    # other props
)

Once you purchase your licence, you can follow the directions here: