I use a parameterized class to build my Panel dashboard.
I would like to use a CrossSelector but this selector does not seem to be available when looking at the options that library Param gives. It only seems to have a ListSelector.
How do i get this CrossSelector using Param?
import param
import panel as pn
pn.extension()
class ValveExplorer(param.Parameterized):
selected_features = param.ListSelector(
default=[1, 3],
objects=[1, 2, 3, 4],
)
valve_explorer = ValveExplorer()
# show list selector
pn.Row(valve_explorer.param['selected_features'])
This results in the following default ListSelector but I don't want this one. I would like to get a CrossSelector instead:
Param has a default widget for every Selector, but you can change this.
You can override this default widget as follows to get the CrossSelector in your example by using pn.Param():
pn.Row(pn.Param(
valve_explorer.param['selected_features'],
widgets={'selected_features': pn.widgets.CrossSelector}
))
A similar solution found on SO is using pn.panel():
pn.Row(pn.panel(
valve_explorer.param['selected_features'],
widgets={'selected_features': pn.widgets.CrossSelector}
))
See more documentation on using Param with Panel here:
https://panel.pyviz.org/user_guide/Param.html