m-wrzr / streamlit-searchbox

Streamlit searchbox that dynamically updates and provides a list of suggestions based on a provided function
MIT License
253 stars 33 forks source link

Pass additional parameters to the search function #38

Closed denisvirissimo closed 7 months ago

denisvirissimo commented 8 months ago

Is it possible to pass other parameters to the search function besides the searchterm?

If not, maybe considering this as an enhancement would be nice.

m-wrzr commented 8 months ago

Do you mean passing additional kwargs to st_searchbox and then forward them in the callback? The only data we get back from react is the current input and/or a selection?

Willianjesusdasilva commented 7 months ago

Hi m-wrzr, how are you? When I think about a search box, Google search box is the first option that comes to mind. I think, let's put my question here... and if this autocomplete doesn't work, I will add a new question.

Can i do it now? is to hard for implement it?

denisvirissimo commented 7 months ago

Do you mean passing additional kwargs to st_searchbox and then forward them in the callback? The only data we get back from react is the current input and/or a selection?

Yeah, passing like kwargs that would be forwarded to the function that executes the search

m-wrzr commented 7 months ago

@denisvirissimo I've just released a new version 0.1.9 where the the kwargs are forwarded. Thanks for the suggestion!

m-wrzr commented 7 months ago

@Willianjesusdasilva

can you try using edit_after_submit="option"? also check out this issue: https://github.com/m-wrzr/streamlit-searchbox/issues/35 - looks like this:

https://github.com/m-wrzr/streamlit-searchbox/assets/6058447/8ea768ed-bac2-43c1-8f91-d7c10e67fcd3