Hi everyone,
I’m currently working on a project using Dash and the Mantine Components library, and I’ve encountered an issue with the MultiSelect
component. When I use the search functionality to filter the list of options and then select an item, the search text is immediately cleared/reset. This is disrupting the user experience as the user has to retype the search text if they want to select multiple items from the filtered list.
Here’s a quick summary of the issue:
- What I’m using : Dash Mantine Components (
dmc.MultiSelect
) v0.14 - Expected behavior : After selecting an item from the filtered list, the search text remains so users can continue selecting items.
- Actual behavior : The search text is cleared/reset as soon as an item is selected.
In this GIF, I’m trying to select all occurrences of “Infraction” from the list. However, as you can see, I have to retype the searchValue
multiple times to retrieve the occurrences, which makes the process cumbersome.
Here’s my implementation of MultiSelect
:
def get_dropdown(filter_placeholder: str, filter_id: int, values: list, values_bis: list) -> dmc.MultiSelect:
'''
Fonction renvoyant un élément Dash de liste déroulante
- filtre_placeholder : chaine de caractère affichée nommant la liste déroulante
- filter_id : id du filtre concerné
- values : liste des valeurs présentent en options (affichée)
- values_bis : liste des valeurs de chaque options
'''
return dmc.MultiSelect(
id={'type': 'filter_dimension', 'index': filter_id},
data=values,
placeholder=filter_placeholder,
value=values_bis,
clearable=True,
style={'width': '100%'},
searchable=True,
withScrollArea=True,
comboboxProps={"transitionProps": { "transition": 'pop', "duration": 200 }},
className="custom-multi-select",
label=filter_placeholder
)
Questions :
- Is there a built-in way to preserve the search text after a selection ?
- If not, does anyone have a workaround for this issue, such as managing
searchValue
with callbacks or another method ? - Could this be considered for improvement in a future release ?
I’d love to hear any advice or best practices for solving this problem. Thanks in advance for your help !
Best regards,
Valentin.