Skip to content

Accessing bokeh models #6073

Open
Open
@hyamanieu

Description

ALL software version info

Python 3.10.12
Panel: 1.3.4
Bokeh: 3.3.2
Param: 2.0.1

Description of expected behavior and the observed behavior

I would like to bump up #2834 with a new issue.
It's become even harder in Panel v1 to access models due to -- maybe -- this shadowRoot story, see https://discourse.holoviz.org/t/sync-scrollbars-for-wide-tabulators/5459 by @hoxbro .

My temporary solution for #2834 was to rebuild every class I required access from the document and updating _rename.update({'_name': 'name'}), then I would use _name on python side in lieu of name as in bokeh.

Now it doesn't work.

I can see tags have been added, but getting by tag names do not work either way.

select method on these models (python side) do not work either as on bokeh.

Complete, minimal, self-contained example code that reproduces the issue

import panel as pn
import param
try:
    s.stop()
except:
    pass
class Column_with_name(pn.Column):
    _name = param.String(default='')

    _rename = pn.Column._rename.copy()
    _rename.update({'_name': 'name'})

c = Column_with_name(tags=['some_tag'], name='name', _name='_name')
ti = pn.widgets.TextInput(name='foo')
c.append(ti)
ti.jscallback(args={'col':c}, value="""console.log('name: '+col.name);
              console.log('id: '+col.id);
              console.log('get _name: '+document.getElementsByName('_name').length);
              console.log('get name: '+document.getElementsByName('name').length);
              console.log('get tags: '+ document.getElementsByTagName('some_tag').length);
              console.log('get id: '+ document.getElementById(col.id))""")
s = c.show(port=8080, open=False, admin=True)

Stack traceback and/or browser JavaScript console output

name: name bokeh.min.js:4:15
id: 1778972f-1032-49cb-a0bd-5cdc7ebf5653 bokeh.min.js:5:23
get _name: 0 bokeh.min.js:6:23
get name: 0 bokeh.min.js:7:23
get tags: 0 bokeh.min.js:8:23
get id: null

I was at least expecting "1" as length for "get _name" and "get tags", and "name" to be "_name" in the first console log.

Screenshots or screencasts of the bug in action

  • I may be interested in making a pull request to address this

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    TRIAGEDefault label for untriaged issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions