View Full Version : how to get node's id & text of a treepanel

9 Aug 2012, 7:01 PM
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.

9 Aug 2012, 7:31 PM
With TreePanel "itemclick" event handler, the first argument is Ext.view.View object, not node object. Try this:

listeners: {
itemclick: function(view, node) {
alert( node.get('id') + node.get('text') );

9 Aug 2012, 8:17 PM
Thank you very much. It works!