Issue with Bokeh AutocompleteInput in jupyter notebook cell
Issue with Bokeh AutocompleteInput in jupyter notebook cell
I'm using an AutocompleteInput widget in a jupyter notebook. The autocompletion itself is working fine but I have an issue with the output.
Issue circled in red
Is it possible somehow to be able to see the ouput of the autocompletion without having to scroll (which is really not user friendly) ? (resizing the output cell of the notebook, autofiting the cell, option of the AutocompleteInput widet)
this is what i've done at the moment:
input_widget = AutocompleteInput(completions=list(df_competences['libelleCompetence']), title='Chercher une compétence', placeholder='Chercher une compétence', sizing_mode='scale_height', css_classes=['my_autocomplete_class'])
show(input_widget)
I've been looking a lot of possibilities but not founding a way to do this...
1 Answer
1
In case someone fall on the same issue as me, here is how I manged to fix it:
I'm getting the HTML code generated by bokeh, remove the class used by bokeh and replacing it with my own one. Then, you just need to create your own css class to make the autocompletion output suitable.
Here is the code:
from IPython.display import HTML
input_widget = AutocompleteInput(completions=list(df_competences['libelleCompetence']), title='Chercher une compétence: ', placeholder='Chercher une compétence', sizing_mode='scale_both', css_classes=['my_autocomplete_class'])
script, div = components(input_widget)
div = div.replace('bk-root', 'my_class')
div = div.replace('<div class="my_class"', '<div class="my_class" style="width: 100%; max_height: 500;"')
HTML(script + div)
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Comments
Post a Comment