Search code examples
autocompletebokehtextinput

Bokeh TextInput parameter to key-stroke listen


I would like to use TextInput/Autocomplete widget in my dashboard and have it being able to listen to each action which is made there, not only after Enter-input or changing focus to another element. My goal is to use Autocomplete widget for filtering dataframe where user could start inputting name of a row and it would be automatically corrected if df had capital letters in name of columns. In other words, df has a column "Price", user inputs "p", Autocomplete immediately corrects it (according to the name of potential column) to "P" and then user finishes inputting it.

As I can see here - https://bokeh.readthedocs.io/en/latest/docs/releases.html on July update (v.1.3.0) this capability was added to TextInput widget. In details of commit there is line "new property "wait_commit" for the event listener". But this parameter doesn't exist and furthermore official Bokeh v.2.0.1 documentation knows nothing about this property at all.

Would be grateful for the help.


Solution

  • wait_commit is in a commit description. What ends up in the source code is listed on the "Files changed" tab, and there's no wait_commit there.

    What you need is the TextInput.value_input property. You can attach a callback to it, and it should be called on any input.

    As for changing focus - I don't think it's possible with the built-in functionality. You would have to extend the existing TextInput and add a new event or property to it.