PDA

View Full Version : extend constructor config object



rsarto
27 Sep 2008, 11:47 AM
Hi guys, i'm trying to extend a class but i need to update the items via the config object passed to the constructor. The code below is not working. Does anybody knows where i can find documentation about the config passed to the constructor (i looked everywhere) or if there is a better way to do this (change the items in the extended class ):

tks.



Ext.ux.RVMenuPanelGroup = Ext.extend(Ext.tree.TreePanel,
{
constructor: function(config)
{
// config.rootVisible = false;
Ext.apply(this,
{
rootVisible: false,
border: false,
lines: false,
root: new Ext.tree.AsyncTreeNode(
{
draggable: false
})
});

config = config || {};
// if (Ext.isArray(config))
// {
// config = {items:config};
// }

console.log('config ', config.items.length);

// this will not work
config.items.each(function(item, index, length)
{

});

Ext.ux.RVMenuPanelGroup.superclass.initComponent.apply(this, arguments);
}
});

Ext.reg('RVMenuPanelGroup', Ext.ux.RVMenuPanelGroup);

mjlecomte
27 Sep 2008, 11:49 AM
http://extjs.com/learn/Ext_Forum_Help#Code_Tags

http://extjs.com/learn/Tutorials#Extending.2C_Overriding.2C_Plugins

rsarto
27 Sep 2008, 11:57 AM
he, he... tks for the quick answer, and sorry about the code and yes, i read all the tutorias about class extend.

tks.

rsarto
27 Sep 2008, 12:21 PM
ok.



for (var x=0; x<config.items.length; x++)
{
config.items[x].leaf = true;
}


works.

tks.