Hey guys,
I am trying to create a multiple choice dropdown for my dash ag grid table, and found dmc.MultiSelect as a good option.
In my dashAgGridComponentFunctions.js file I have the following code:
//dmc select componenet
dagcomponentfuncs.CustomMultiSelect = function (props) {
const {setData, data} = props;
const [selectedOptions, setSelectedOptions] = React.useState(Array.isArray(data) ? data : []);
function onChange(value) {
setSelectedOptions(value);
setData(value);
}
return React.createElement(
window.dash_mantine_components.MultiSelect,
{
data: ['a', 'b', 'c'],
value: selectedOptions,
onChange: onChange,
placeholder: "Select options",
}
);
};
and I reference the component in my dash ag grid table like this:
columnDefs = [
{
"headerName": "Options",
"cellRenderer": "CustomMultiSelect",
},
]
dash_ag_grid.AgGrid(
id="my-table",
dashGridOptions={
"rowHeight": 120,
"rowSelection": "multiple",
"undoRedoCellEditing": True,
"suppressRowTransform": True,
},
columnDefs=columnDefs,
defaultColDef={
"flex": 1,
"sortable": True,
"filter": True,
},
)
I can see the options, but I cannot choose/select anything. Any idea what am I doing wrong? Thanks!