Do you also happen to know is there a way to have the Tabulator inside the app somehow, as a parameter? I have the feeling it would offer a more natural interaction between the objects.
The way it is now, I need to go “outside” of the scope of the class, and then “back inside” to use its methods.
Let me illustrate
import panel as pn
import pandas as pd
import numpy as np
import holoviews as hv
data = param.DataFrame(doc="Values as Pandas DataFrame")
update_data = param.Event(label='New Random Numbers')
def __init__(self, **params):
table_ = pn.widgets.Tabulator.from_param(self.param.data, selectable='checkbox')
self.data = get_random_data()
############# the only different part #############
# this is a method that I would like to use
if selection is None or len(selection)==0:
selection = self.data.index
selection = list(selection)
app = DataProfile(data=get_random_data())
# here I create the Tabulator outside of the DataProfile scope
tbl = app.create_table()
layout = pn.Column(
# here I'm back to using the DataProfiler method
This is how my code looks like currently, but I feel like the holoviz developers have provided all these awesome and elegant solutions and bindings, that I am certain I am just missing something when I find myself needing to reach for what feels like a hacky implementation.
I have the feeling Marc’s suggestion is close to the best you can get. It is true that panel can map param Parameters (Number, String, Boolean, Selector, etc.) to widgets and thanks to that you can evolve in param's world to code your apps. Representing in a GUI interface like panel one of these simpler Parameters (e.g. a Number into a FloatSlider) is rather straightforward. But all the ways you can interact with a Dataframe mean that it would certainly not make sense to change param to support them, param isn’t only about GUI programming after all. So in these cases you have to go into panel's world more. I use from_param quite a lot to do that, I find it a natural pattern to keep things in sync.