PDA

View Full Version : Ext.extend



yumusakg
1 Jul 2010, 3:31 AM
is something wrong with the following method of extending? i think "arguments" will be "config".

i saw this example in http://www.sencha.com/learn/w/index.php?title=Tutorial:Extending_Ext_for_Newbies



// MyPanel Extends Ext.Panel
MyPanel = Ext.extend(Ext.Panel, {
constructor: function(config) {
Ext.apply(this, {
width: 300,
height: 300
});
MyPanel.superclass.constructor.apply(this, arguments);
}
});

fay
1 Jul 2010, 3:41 AM
Take a look at this very good description of extending: http://www.sencha.com/forum/showthread.php?54537-code-structure&p=259901

yumusakg
1 Jul 2010, 3:49 AM
I saw the code sample in the tutorial above. just want to learn anything is wrong?

fay
1 Jul 2010, 3:55 AM
If you look at the Ext Version for that example it is 2.2. Follow the link (http://www.sencha.com/forum/showthread.php?54537-code-structure&p=259901) I provided and read MJ's description.



constructor: function (config) {

// apply anything specified in the configuration object to this object
Ext.apply(this, config);

// Reusable config options here
Ext.apply(this, {
width: 300,
height: 300
});

// call the superclass to preserve base class functionality
MyPanel.superclass.constructor.call(this);

// ...
},