Dash Dropdown No results found custom message

Hello,

I wonder if there is a possibility to change the “No results found” message displayed in the searchable dropdown when the search value does not match any of the available options. My application is not in english, so I would like to show this message in the native language of my users.

Thanks

I added this dictionary into meta_tags but it did not work. Chrome was able to translate it into my language, when manually ordered to, but it worked even without this entry in the meta_tags. Other browsers (Firefox, Opera and Edge) displayed the message in english.

My understanding is that this solution relies on browser´s capability to translate webpages. However, I would like to change the message itself somewhere in my code, if it is even possible. Any ideas how to do that?

Please note, that I am just enough skilled to create simple apps as a hobby and I am not a seasoned programmer, I would describe myself as a beginner :slight_smile:

@Martinm

I founded that link that explain how to do in js, I supouse there exist a way to change it using css file, but I couldnt find a way to do it.

I’m an Accountant and a code beginner too :woozy_face:

I will try to go through css, maybe I will find something useful. If not, I can just hide the text by setting its opacity to zero :slight_smile:

1 Like

I came up with a little workaround.

I took advantage of the fact that my options are dynamically generated, so I added one final check before the underlying function returns the options. It checks if the list of options contains at least one option and if not, it creates one with the label showing a custom message, arbitrary value (in my case it is just 0) and disabled property set to True. This custom message must contain the search_value itself, to be shown as the dropdown option. So it is roughly something like:

“search_value” was not found. Try to refine your query.

I still had changed the opacity of the original “No results found” to zero, as it was showing up before the search_value was entered into the dropdown and even sometimes during the typing as the options are generated by posting the search value to public API and processing the JSON string it returns.