hvplot icon indicating copy to clipboard operation
hvplot copied to clipboard

Can't use select widget to update interactive table

Open gawells opened this issue 2 years ago • 3 comments

Software (anaconda in windows 10/11): panel: 0.12.4 holoviews: 1.14.6 hvplot: 0.7.3 python: 3.9.7

I'm trying to use the select widget to choose which column appears in an interactive table. This works when returning a dataframe:

import panel as pn
from bokeh.sampledata.autompg import autompg
pn.extension()

s = pn.widgets.Select(options=list(autompg.columns))
def t(col1): return autompg[[col1,'cyl']]
    
pn.Column(s, pn.bind(t, col1=s))

But not for an interactive table:

import panel as pn, hvplot.pandas
from bokeh.sampledata.autompg import autompg
pn.extension()

s = pn.widgets.Select(options=list(autompg.columns))
autompg = autompg.interactive()
def t(col1): return autompg[[col1,'cyl']]
    
pn.Column(s, pn.bind(t, col1=s))

The reason I'm using the latter is because I also want to combine it linked selections as described here.

gawells avatar Dec 03 '21 15:12 gawells

Not quite sure what's up with that but this works:

s = pn.widgets.Select(options=list(autompg.columns))
autompg = autompg.interactive()

def t(col1): 
    return pn.pane.Interactive(autompg[[col1,'cyl']])

philippjfr avatar Dec 07 '21 17:12 philippjfr

Appears to be a bug in .interactive itself. The process that is used to discover how to render the component seems to leave the Interactive object in a weird state where it renders as something other than what we want.

philippjfr avatar Dec 07 '21 18:12 philippjfr

I can reproduce.

maximlt avatar Oct 14 '22 18:10 maximlt