Hi everyone.
I’m trying to filter my Ag Grid table by using a toggle (Switch from Dash Mantine Components).
dmc.Switch(
id=f"{prefix}__feature_selection_table_switch",
label="Show Only Selected Rows",
checked=False,
mb=20,
display="none",
)
I want to filter my table so only rows that I selected are shown when I click on this toggle, but I can’t find reference for how to check if a row is selected or not.
This is what I have now in my callback:
@callback(
Output(f"{prefix}__feature_selection_table", "dashGridOptions", allow_duplicate=True),
Input(f"{prefix}__feature_selection_table_switch", "checked"),
State(f"{prefix}__feature_selection_table", "dashGridOptions"),
prevent_initial_call=True,
)
def filter_only_selected_rows(filter_checked: bool, options):
grid_options = options
grid_options["isExternalFilterPresent"] = {"function": "true" if filter_checked else "false"}
grid_options["doesExternalFilterPass"] = {"function": "node.selected"}
return grid_options
This node.selected condition is not working, and this needs to be changed for this to work, but I don’t know what to.
I’m using Dash 2.17.0 and AG Grid 31.2.0