PDA

View Full Version : Adding new attributes to AsyncTreenode



sujio
7 Dec 2009, 2:52 AM
Hi ,

I wanted to extend AsyncTreenode to add a new config attribute to it. I tired going through the tutorials given for extending a class/component but was not able to figure it out.

I am new to ExtJS and am using verison 3.0. Any help is much appreciated ( i understand this might be a very basic question, i tried figuring it out for a whole day but couldn't get the answer).

Thanks.

Animal
7 Dec 2009, 3:04 AM
You can add any attributes you like. You don't have to extend a class to do that.

sujio
7 Dec 2009, 8:01 AM
Hi,
This is what i was trying to do....

I am creating a tree using static data given below:

var children = [{
text:'First Level Child 1',
id:"abc"
,caseId:99000
,children:[{
text:'Second Level Child 1'
,id:"123"
,leaf:true
,caseId:9900
},{
text:'Second Level Child 2'
,leaf:true
,caseId:00
}]
},{
text:'First Level Child 2'
,caseId:900
,children:[{
text:'Second Level Child 1'
,leaf:true
,caseId:990
},{
text:'Second Level Child 2'
,leaf:true
,caseId:99
}]

}];


'caseId' is the new attribute that i would like to add.but once the tree is created and i try to get the caseId when the node is expaned using

tree.on('expandnode',function(node){
alert(node.caseId);
});

it shows the value as undefined? Can you tell me what i am doing wrong.I am using tree panel with AsyncTreeNode.

Animal
7 Dec 2009, 8:08 AM
http://www.extjs.com/deploy/dev/docs/?class=Ext.data.Node&member=attributes

sujio
7 Dec 2009, 9:19 AM
Hi ,

Thanks a lot... sorry about the silly doubt :).