PDA

View Full Version : building a component



vektor7
2 Jul 2008, 1:08 AM
I have two pieces of code:
1) A viewport with the application layout (working)
2) A standalone TreePanel (working)

Now I want to build a component "mytreepanel" (2) which I can include in the viewport (1) like Saki describe it in his blog Writing a big application (http://blog.extjs.eu/know-how/writing-a-big-application-in-ext/). Now I changed the code to:

mytreepanel:

[code]Ext.ns('ma');

ma.MyTreePanel = Ext.extend(Ext.tree.TreePanel, {
useArrows:false,
autoScroll:true,
animate:true,
enableDD:true,
containerScroll: true,
title:'Medienexplorer',
loader: new Ext.tree.TreeLoader({
dataUrl:'../app/ext/tree-getNodes.php',
preloadChildren: false
}),
setRootNode: new Ext.tree.AsyncTreeNode({
text:'Best

evant
2 Jul 2008, 1:13 AM
setRootNode is a method. You're overriding it in your class as though it's a property.

It won't work.

vektor7
3 Jul 2008, 8:11 AM
Thanks for short but clear answer! I changed the public method "setRootNode" with the public property "root" and it works fine. Code:

[code]ma.MyTreePanel = Ext.extend(Ext.tree.TreePanel, {
useArrows:false,
autoScroll:true,
animate:true,
enableDD:true,
containerScroll: true,
title:'Medienexplorer',
loader: new Ext.tree.TreeLoader({
dataUrl:'../app/ext/tree-getNodes.php',
preloadChildren: false
}),
root: new Ext.tree.AsyncTreeNode({
text:'Best

evant
3 Jul 2008, 2:44 PM
1) Not sure what you're asking here.

2) You add listeners to whichever component is firing the event. Once you catch the event, THEN you write code to communicate with other components.