vpusher / paper-tree

Browsable tree of nodes with expandable/collapsible capabilities and actions menu
MIT License
27 stars 24 forks source link

the _selectNode is not executed #1

Closed mbarqawi closed 7 years ago

mbarqawi commented 7 years ago

the _selectNode is not executed ,

 _selectNode: function(e) {
            if(this.selected) {
                this.toggleClass("selected", false, this.selected);
            }
            this.selected = e.target;
            this.toggleClass("selected", true, this.selected);
        }

this how I put it in my page

<paper-tree id="tree2" selected={{selected_node}} ></paper-tree>     
<span>{{selected_node}}</span>
 <script>
    Polymer({
      is: 'my-view2'
      ,
      properties: {
      param: {
        type: Object,
      }
    },
    attached: function(e) {
      console.log('innerParam', this.param);
       var tree = this.$.tree2;
                // Only one node.
                debugger;
                tree.data = {
                    "name": "Hello",

                        "children": [{
                        "name": "World"
                    }, {
                        "name": "There"
                    }, {
                        "name": "You",
                         "icon": "account-circle"
                    }]
                };
    }
    });
  </script>
vpusher commented 7 years ago

@mbarqawi Whenever a node is selected, the _selectNode method is called. So you need to select a node before seeing _selectNode executed. By default no node is selected.

Concerning your binding, you are probably looking for something like

<span>{{selected_node.data.name}}</span>

Here is a working example similar to what you are trying to achieve

mbarqawi commented 7 years ago

the selection is working as expected on Firefox but on chroum is not working it like the listeners for select event is not handled in the paper tree element

I'm sure that i have something wrong but I don't know where I can share my code with you if you have account on c9.io

platoscave commented 7 years ago

See issue #2 May be related.