grandanat
12 Feb 2010, 2:52 AM
hi all
i saw two main different techniques of declaring extJs objects:
Ext.ns('Ext.myapp');
Ext.myapp.MyObject = function(config) {
config = config || {};
var myVar = 3;
Ext.myapp.MyObject.superclass.constructor.call(this, config);
...
};
Ext.extend(Ext.app.myapp.MyObject, Ext.util.Observable);
Ext.app.itemsearch.SearchPanel = Ext.extend(Ext.form.FormPanel, {
});
and
Ext.ns('Ext.myapp');
myVar : 3;
constructor: function(config) {
Ext.apply(this, config);
},
...bla, bla
});
What are advantages and disavantages of each of these two ways
Also declarations of variables is strong related, in first case natural "var =" , asecond is json way (:). Please comments in this too.
Please give as much details as possible. I'm just starting to learn extJS.
10x
i saw two main different techniques of declaring extJs objects:
Ext.ns('Ext.myapp');
Ext.myapp.MyObject = function(config) {
config = config || {};
var myVar = 3;
Ext.myapp.MyObject.superclass.constructor.call(this, config);
...
};
Ext.extend(Ext.app.myapp.MyObject, Ext.util.Observable);
Ext.app.itemsearch.SearchPanel = Ext.extend(Ext.form.FormPanel, {
});
and
Ext.ns('Ext.myapp');
myVar : 3;
constructor: function(config) {
Ext.apply(this, config);
},
...bla, bla
});
What are advantages and disavantages of each of these two ways
Also declarations of variables is strong related, in first case natural "var =" , asecond is json way (:). Please comments in this too.
Please give as much details as possible. I'm just starting to learn extJS.
10x