I have the following code that creates a simple cross selector and pressing the button should print out what was selected:
button = pn.widgets.Button(name='Update', button_type='primary')
cross_selector = pn.widgets.CrossSelector(name='Fruits', options=['Apples', 'Bananas', 'Cranberries'])
# Eventually update some plot with df[cross_selector.value]
Initially, when nothing is selected, pressing the button prints out an empy list. However, once something is selected and moved over to the right, pressing the button does not print anything anymore and I can’t seem to figure out why.
I’ve been able to reproduce what you observed. It’s a little strange as if you check your browser console you should actually observe that the right value is being logged. However, it seems that in the notebook the log stops being emitted as soon as you interact with the CrossSelector.
@maximlt Are you aware of any other alternatives for sub-selecting from a list that is similar to the cross selector? Ultimately, the selection will be used to query/filter a Pandas dataframe and then update a plot dynamically.
Thanks @Hoxbro. In my real use case, I have something like 4000+ items in the list and so the Cross Selector was nice because you can narrow things down by typing in keywords in order to filter down the list.
In my testing the selection in the cross selector had no problem, the issue was the logs emitted by the print statement not being displayed in the Notebook (but being correctly displayed in the console). So I think the functionality you’re looking for is working.
Are you looking for another widget to try to improve the UX?