I’ve tried this, but it never doesn’t change the options of the “y” select, even though the set_y_options
function is being called:
x_to_y = {'A': [1, 2, 3], 'B': [4, 5, 6]}
xs = list(x_to_y)
x_select = pn.widgets.Select(value=xs[0], options=xs, name='x')
y_select = pn.widgets.Select(value='', options=[''], name='y')
def set_y_options(x):
y_select.options[:] = ['']
y_select.value = ''
y_select.options.extend(x_to_y[x])
return repr((x_select.value, y_select.options))
def show_stuff(x, y):
return repr((x, y))
set_ = pn.bind(set_y_options, x=x_select)
show = pn.bind(show_stuff, x=x_select, y=y_select)
pn.Column(pn.Row(x_select, y_select), show, set_, sizing_mode='stretch_width')