PDA

View Full Version : this.getSelectedNodes not working as expected



Ash2009
7 Aug 2009, 1:31 PM
Hi ,

I created my own treepanel class extending from Ext.tree.TreePanel .
This class gets instantiated multiple times in different tabs,so there r different tree in different tabs coming from the same class.
My tree has MultiSelectionModel which allows me to press 'ctrl' key and select more than one nodes across not just one tree but also from all the other tree instances in other tabs.so far good.
The issue comes when i do a
this.getSelectionModel().getSelectedNodes();

I am expecting the above call to return me all the selected nodes from the current tree ('this' object) ,but somehow I am getting all the selected nodes across all the instances of the tree from all the different tabs.Is this behavior right ?
The problem is if some nodes are selected in one tab(one instance of the tree) and I do any operation on another instance of the tree in next tab then that operation affects the selected nodes from the earlier tree too which is not what i am expecting.
I want to know if this is a Ext bug or some wrong implemenation on my side.
I can provide my tree code or more info if needed ,since its a pretty large file.

Thanks.any inputs are appreciated.

Ash2009
7 Aug 2009, 1:41 PM
I am using Ext 2.2.1 , FYI

Animal
7 Aug 2009, 2:05 PM
Post in the 2.0 help folder then.

I suspect it's an extend to configure problem.

Animal
7 Aug 2009, 11:46 PM
Show your code!

Extending to configure is generally bad.

It has caught on in a horrible way though.

Ash2009
9 Aug 2009, 9:31 AM
Hi ,
I can attach my code,but its a 1000 lines of code and i dont know what part of code could be faulty ,if u could help me understand whats a extend to configure problem ,I can look myself into the code and point out the wrong configurations.
Please tell me what exactly should I look for or if you want to see my code then what part should i send from the 1000 lines so that its easier for you to go thru ?

Thanks ,appreciate your help

Animal
9 Aug 2009, 12:53 PM
Show your tree subclass

Ash2009
9 Aug 2009, 4:39 PM
Hi Animal,

I have attached my Tree subclass.

Animal
10 Aug 2009, 2:51 AM
Anything you put into the prototype of a class is shared among all instances of that class.

Ash2009
10 Aug 2009, 9:49 AM
Thanks a lot ,that cleared the concept and also explained the unusual behavior.