about extend
myGridPanel is more than Ext.grid.GridPanel that some attributes or methods.
Ext.namespace('myGridPanel');
myGridPanel = function() {
myGridPanel.superclass.constructor.call(this);
};
Ext.extend(myGridPanel, Ext.grid.GridPanel, {
myName : 'myName',
setMyName : function(name) {
this.myName = name;
}
})
there is something wrong in my code. But i didn't know where is it.
var grid = new myGridPanel( {
store : store,
cm : cm,
viewConfig : {
forceFit : true
},
plugins : expander,
collapsible : true,
animCollapse : false,
title : 'here is the title',
iconCls : 'icon-grid',
renderTo : 'center-div'
});
like this , i use myGridPanel, the title didn't display. so i think there must be something wrong in my code about extend.
but just have a little problem about this :
MyGridPanel = function(config) {
MyGridPanel.superclass.constructor.call(this, config);
};
what is the config's meaning?
Ext.namespace('myns');
myns.MyGridPanel = function(config) {...};//this config is what?
Thank you again !~~I know it~!:)
Didn't you notice you were already using it?
var grid = new MyGridPanel({
store : store,
cm : cm,
viewConfig : {
forceFit : true
},
plugins : expander,
collapsible : true,
animCollapse : false,
title : 'here is the title',
iconCls : 'icon-grid',
renderTo : 'center-div'
});
MyGridPanel = function(config) {
MyGridPanel.superclass.constructor.call(this, config);
};
ps.
1. Classes are commonly written in uppercase while instances are written in lowercase, e.g.
var myGridPanel = new MyGridPanel({...});
2. Namespaces are containers for classes ('packages'), not the class itself, e.g.
Ext.namespace('myns');
myns.MyGridPanel = function(config) {...};
#If you have any other info about this subject , Please add it free.# |
omr06vg8k1ys