(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
)