panel icon indicating copy to clipboard operation
panel copied to clipboard

Support jscallback on Editable sliders

Open 2beetle opened this issue 1 year ago • 2 comments

(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc) python 3.9 panel 1.3.6

I copy the example code and make a jscallback test, when I change IntSlider to EditableIntSlider the html file report the error

import panel as pn
gauge = {
    'tooltip': {
        'formatter': '{a} <br/>{b} : {c}%'
    },
    'series': [
        {
            'name': 'Gauge',
            'type': 'gauge',
            'detail': {'formatter': '{value}%'},
            'data': [{'value': 50, 'name': 'Value'}]
        }
    ]
}
gauge_pane = pn.pane.ECharts(gauge, width=400, height=400)

## the example code is IntSlider and have no error
slider = pn.widgets.EditableIntSlider(value=50, start=0, end=100)

slider.jscallback(args={'gauge': gauge_pane}, value="""
gauge.data.series[0].data[0].value = cb_obj.value
gauge.properties.data.change.emit()
""")

pn.Column(slider, gauge_pane).save('/Users/be/Desktop/panel_test/analysis_of_heterotic_groups_in_maize_test1.html')

image

2beetle avatar Jan 19 '24 08:01 2beetle

The issue here is that editable sliders are composite widgets that are primarily implemented in Python. The JS callback has to be linked to the underlying slider model while it is likely being linked to the layout that surrounds the slider and text input right now.

philippjfr avatar Jan 19 '24 11:01 philippjfr

The issue here is that editable sliders are composite widgets that are primarily implemented in Python. The JS callback has to be linked to the underlying slider model while it is likely being linked to the layout that surrounds the slider and text input right now.

got it. Thanks

2beetle avatar Jan 22 '24 02:01 2beetle