paper-tree icon indicating copy to clipboard operation
paper-tree copied to clipboard

Deep linking support

Open chisholmd opened this issue 8 years ago • 1 comments

How is deep linking supported? I was expecting to see a "selected" property that I could bind to my JSON but there is only "open".

Here is an example of deep linking to a tree.
http://52.90.210.88/kb/#/en-US/home/2/3/4?topic=kidH4_775_c1

When you follow the link the tree is opened to reveal the "Screen Frozen" node, and that node is selected.

option 1: load the tree and then imperativly traverse the tree looking for the right node and imperativly firing its "selected" state.

option 2: have the open and selected state in the JSON and bind it.

jsTree has a nice section in tree JSON for state info including selected, that's what I would like to see. https://www.jstree.com/docs/json/

{ id : "string" // will be autogenerated if omitted text : "string" // node text icon : "string" // string for custom state : { opened : boolean // is the node open disabled : boolean // is the node disabled selected : boolean // is the node selected }, children : [] // array of strings or objects li_attr : {} // attributes for the generated LI node a_attr : {} // attributes for the generated A node }

chisholmd avatar Sep 06 '17 20:09 chisholmd

added a "selected" boolean to my data.json then in paper-tree-node.html

connectedCallback() { super.connectedCallback(); if(this.selected){ this.select(); }
}

Seems to do the trick nicely

chisholmd avatar Oct 01 '17 03:10 chisholmd