I am trying to make a simple dashboard, where I have some filters and a button, which when pressed should show the DataFrame with the filtered data.
Something in line with this, for instance:
I feel that such a dashboard is a good use case for param.Parameterized classes, where @param.depends('button') would trigger the Data to update and therefore I wished to get a decent understanding of how it all works.
However, I feel somehow stuck in getting started. Probably because I am not sure what would be the best practices to use pn.widgets.MultiChoice within param.Parameterized.
The following code seems to work, although I am not fully sure why.
I am still skeptical that I am doing it correctly and I will not run into issues later on.
You should almost never use a pn.widgets in the class declaration, as all objects will share it.
Instead, you should use param.Parameter and pn.Param either inside the class or outside on the object. I have chosen the first in my example below.
Try to look at pn.viewable.Viewer, which is almost the same as a param.Parameterized class except it has a __panel__ method which removes the need for calling your dashboard method. (I haven’t done that in my example below).