How do I find the selected node in an ExtJS TreePanel? -
When I click the user button I am trying to retrieve the selected node of TreePanel. How do you select the node in TreePanel? Thank you.
What you will do, create an event handler There are several events in each exchase object that will automatically be accompanied by them are connected. You will write an event handler (a function), which you can assign to an event listener. Therefore, in this case, you probably want to assign event handler to the 'click' event of your trippan component. Click here
var tbPan = new Ext.tree.TreePanel ({itemId: '(click: {FN: click listener}}}, click; ClickListener = function (node, event ) {// node argument represents the node that was clicked inside your trippanel;); But, what if you already want to know the selected node? At that point you will need access to Trypanel's selection model. Suppose you mentioned a button action that you want to apply the function to the click handler of that button to get the selected button:
var btn = new Ext.Button ({text: 'Get value', handler: function (thisBtn, event) {var node = ext. Flight ('navirtree'). GetSelectionModel (). GetSelectedNode ();}}); You used the flyweight element to get quick reference for TreePanel, then used the tree's internal method to get its selection model. After that you used that selection model (in this case the default selection module) to obtain the selected node internal method.
You will get the wealth of information within Ex JS documentation. The online (and offline AIR app) API is quite extensive. The Ext Core Manual can also give you a lot of information about EXGs development, even if you are not using the core directly.
Comments
Post a Comment