-
3 May 2012 10:31 AM #1
TreePanel or TreeNode suspendEvents not working
TreePanel or TreeNode suspendEvents not working
I have a treepanel on my page which has "click" and "expandnode" listeners registered to it.
Now I have a scenario in which based on user action I am expanding and collapsing node based on user selection. In this case I don't want the "expandnode" listener to be fired so I am calling its suspendEvents method before expanding a node (node.expand()). But the event is still getting fired. below is the snapshot of code ...
Code:// tree panel definition { xtype: "treepanel", title: "Title", id: "someid", rootVisible: false, autoScroll: true, bodyStyle : "padding:5px;", root: new Ext.tree.TreeNode({ text: "All" }), listeners: { click: function(inNode, inEvent) { methodcall(); }, expandnode: function(inNode){ methodcall(); } } } // after building the tree, I have to expand the nodes that has child nodes // so calling this piece to expand the nodes and I dont want expandnode to be fired // when i do so. I also tried treepanel.suspendEvents...still the event is getting fired like // a gatling gun for(var i=0;i<rootNode.childNodes.length;i++) { var parentNode = rootNode.childNodes[i]; if(parentNode.hasChildNodes()) { parentNode.suspendEvents(false); parentNode.expand(); // this is the point where expandnode event is getting fired parentNode.resumeEvents(); } for(var j=0;j<parentNode.childNodes.length;j++) { var childNode = parentNode.childNodes[j]; if(childNode.hasChildNodes()) { childNode.suspendEvents(false); childNode.expand(); // this is the point where expandnode event is getting fired childNode.resumeEvents(); } } }
-
7 May 2012 6:52 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
Is this an Ext JS 3 question? There is no TreeNode in Ext JS 4
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
10 May 2012 5:54 AM #3
Yes mitch, this is an ext js 3.x question...did i post this question in wrong section?
-
10 May 2012 8:07 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
21 May 2012 11:22 AM #5
Looks like its a bug in Ext JS 3.x. I couldn't find a solution to this in any of the forum that had same scenario.


Reply With Quote