which produces a file selection widget, a dropdown menu and a button:
I now want to modify the code such that the button can be removed. I want updates to be triggered automatically when a file is uploaded. That is, I want to watch for changes of a global variable (file_upload) inside a param.Parameterized class. The function refreshData needs to be called every time a file is uploaded.
Ideally I would want to replace @param.depends('unwantedButton', watch=True) with @param.depends('file_upload', watch=True)
Well, there actually does seem to be a minor issue. I need to first select a different value in the dropdown menu, because otherwise it returns “Please upload data”
Ok I’m not 100% I think there was another issue I read in the forum with something similar been looking but haven’t found. I’ve tried to but been unsuccessful to trigger an initial select
It might be a running issue, there’s an open github about it in the below link if it’s the same issue
The result of self.select is a number for case 1, but a letter for case 2. That is, if in both cases the first entry is selected, case 1 returns 1 and case 2 returns A. How do I get the number for case 2?
Ok, for future reference I “fixed” this by using self.select = df.columns[0] after changing self.param.select.objects to select the first column in df.
One comment to assigning a dict to param.selector.object.
That only works OK at init. Later you’ll need to assign the dict to param.selector.names and the dict.values() to param.selector.objects.
Will flow through to widgets correctly as well.