Hi everyone,
How can I add custom properties into control objects in ExtJs.
For example :
var button = new Ext.Button({
text:"something",
id:"somethingId"
})
This control comes from server dynamically and I want to write my custom property as well like below :
var button = new Ext.Button({
text:"something",
id:"somethingId",
customField : "I created this one"
})
and then I want to reach it like below :
alert(button.customField);
In my real case I am doing this type to create AsyncTreeNode
at server and send them to client and append them via TreeLoader
, and those nodes helps me show a picture when clicked so I want them to have a address field so I can get it in TreePanel
click event which returns clicked node as well :
listeners:{
click : function(clickedNode,eObj){
alert(node.customFields);
}
}
I tried it but it said undefined
. Normally since JavaScript is loose, I can easily modify objects but in this case it wouldn't work the way I expected.
Thanks in advance....