haibijon
16 Mar 2007, 11:23 AM
I was wondering if anyone had any suggestions/advice on handling default options in ext. My current code looks like the following, any advice better way to do this using Ext?
var Component = function( id, config ){
// apply default config
this.someOptions = ['foo','bar'];
this.anotherOption = 42;
// apply passed config to override defaults
Ext.apply(this, config);
};
var x = new Component( 'someId', {
someOptions: ['x', 'y']
} );
var Component = function( id, config ){
// apply default config
this.someOptions = ['foo','bar'];
this.anotherOption = 42;
// apply passed config to override defaults
Ext.apply(this, config);
};
var x = new Component( 'someId', {
someOptions: ['x', 'y']
} );