madeline-scyphers / panel-jstree

a Tree widget for Holoviz's Panel based on jsTree
MIT License
17 stars 1 forks source link

Unable to open a tree in a Golden Template #9

Open marcosfrenkel opened 1 year ago

marcosfrenkel commented 1 year ago

Hello everyone, I am trying to place a custom tree in a golden template for a dashboard I am building. However when I place the tree widget in the template, this does not appear. The following is the script I'm trying to run:

from pathlib import Path

import param
import panel as pn
from panel_jstree import FileTree

class MonitrTree(FileTree):

    checkbox = param.Boolean(default=False, doc="Whether to show checkboxes next to each node")

path = Path("/Users/marcosf2/Documents/playground/monitr_testing_dat/data_small")

monitr = MonitrTree(str(path))
monitr.select_multiple = False
monitr.show_dots = False
monitr.show_icons = False

button = pn.widgets.Button(name="click me", button_type="primary")
tmpl = pn.template.GoldenTemplate(title="Monitr 2.0",
                                  sidebar=[button])
tmpl.main.append(
        monitr
)

pn.serve(tmpl, port=5007)

This is the image that appears from there:

image

When I simply place the monitr object in the pn.serve(monitr, port=5007), the widget displays correctly.

Any help would be appreciated! thanks!

marcosfrenkel commented 1 year ago

I have tried with other templates, and the widget works fine with them. There seem to be something about the golden template that breaks it.