Closed hoggatt closed 2 months ago
In theory, your default option should work, but in practice when I click on the searchbox, the default search doesn't show up.
Furthermore, if I reset or clear the box the default search does not show up again.
Hey, just for my understanding: this is not about the default that is returned in python but the text that is shown in the searchbox? So setting something like the initial search term?
Hey, just for my understanding: this is not about the default that is returned in python but the text that is shown in the searchbox? So setting something like the initial search term?
Exactly, yes. Anytime the box is blank, use this default search term.
My use case here is a folder search combobox. When the box is blank, I want it to show all files in a folder. I don't want users to have to type "." to see everything.
Could you also use default_options
for this? Like:
result = st_searchbox(
search,
default="default_folder_return",
default_options=["your", "list", "of", "folders"],
)
The problem with this is that it won't actively run the search again, which may change over time.
Also, that wasn't working for me when I clear the result.
I see the issue, just hesitant to add an additional argument that might be covered by already existing ones & the state updates having changed somewhat since the fork you linked above..
Can you maybe check if this https://github.com/m-wrzr/streamlit-searchbox/pull/61 would cover the usecase? this resets the searchbox while also updating the default_options
when using clear_on_submit = True
pip install -i https://test.pypi.org/simple/ streamlit-searchbox==0.1.17a
Works perfectly! Thanks for helping with all my issues. This component is excellent and VERY usable for extreme use-cases. I might have one more low-priority minor feature request ;)
I have a use-case where I'd like there to be a default search if my search is blank. I've added this feature to a fork here (search
blank_search_value
).Unfortunately this fork is out of sync with yours, so I can't directly contribute a pull request. Would it be possible to add this feature?
Here is the doc you can add to the readme:
If not None, will set the default search value when the box is initialized or reset.