1. #1
    Sencha User
    Join Date
    Jan 2012
    Location
    Shanghai, China
    Posts
    21
    Answers
    1
    Vote Rating
    1
    tianhao is on a distinguished road

      0  

    Default Answered: how to get node's id & text of a treepanel

    Answered: how to get node's id & text of a treepanel


    Hi all,
    I can get id and text of the node when I expand a node in a treepanel. The code added to listeners like this:
    listeners: { itemexpand: function(node) { alert( node.get('id') + node.get('text') ); } }
    It runs ok. How can I get id and text of the node WHEN I CLICK a node? The code below does not work:
    listeners: { itemclick: function(node) { alert( node.get('id') + node.get('text') ); } }
    Any help will be appreciated.

  2. With TreePanel "itemclick" event handler, the first argument is Ext.view.View object, not node object. Try this:
    Code:
    listeners: { 
        itemclick: function(view, node) { 
            alert( node.get('id') + node.get('text') ); 
    ...

  3. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    With TreePanel "itemclick" event handler, the first argument is Ext.view.View object, not node object. Try this:
    Code:
    listeners: { 
        itemclick: function(view, node) { 
            alert( node.get('id') + node.get('text') ); 
    ...

  4. #3
    Sencha User
    Join Date
    Jan 2012
    Location
    Shanghai, China
    Posts
    21
    Answers
    1
    Vote Rating
    1
    tianhao is on a distinguished road

      0  

    Default


    Thank you very much. It works!

Thread Participants: 1

Tags for this Thread