Hi,
if I update/change the objects of a param.Selector wich is already rendered with panel as a DropDownList, it perfectly updates the objects/values in the DropDownList.
But how can I change the then (new) selected value, to be not the first item?
Complete, minimal, self-contained example code that reproduces the issue/use case
import param
import panel as pn
class Test(param.Parameterized):
value = param.Selector(default=1, objects=[1,2,3])
@pn.depends("value", watch=True)
def update_param(self):
# add one more number to objects
o = self.param.value.objects
new_objects = o + [o[-1]+1]
self.param.value.objects = new_objects
# how can I change the value in a way, it is also updated in the panel widget?
# obviously not like this
self.param.value.default = 2
# and also not by simply setting the value (commented out to not run this function twice due to watch=True):
# self.value = 2
test = Test()
pn.Param(test.param["value"], widgets={'value':pn.widgets.Select}) # maybe this is the wrong usage of a widget in this specific update case?
Thank you dear HoloViz Team for your amazing work with all your libraries.