Firstly, My question is I want to know how different between Ext.Define() and Ext.Create(), and I want to know how to use them in right way.
I reviewed my codes and many Extjs4 MVC tutorials,
and I found many many Ext.define() methods in Extjs4 MVC project.
I understand Ext.define() method create an object (CLASS).
And if I need a panel just for instance, I will not make any inheritance of the panel, also I will not reuse the panel after initialized.
Then, I think I need to use Ext.create() instead of Ext.define().
So, I try to change my code @.@;
In view, it was
Ext.Define("App.view.MyGrid",{
extend : 'Ext.grid.panel',
alias : 'widget.MyGrid',
initComponent : function(){
this.columns : [{ header: 'column' }];
this.store : Ext.create('Ext.data.ArrayStore', {})
}
});
and I change to,
var myGrid = Ext.create('Ext.grid.Panel', {
layout: 'fit',
border: false,
columns: [{ header: 'column' }],
store: Ext.create('Ext.data.ArrayStore', {})
});
After change the code, I got a problem that I can not retrieve(grep) the panel in Controller,
before I did this way before,
refs: [
{
ref: 'myGrid',
selector: '',
xtype: 'MyGrid', //view - alias
autoCreate: true
}
]
this.getMyGrid();
but after change, I don't know how to retrieve that panel in controller.
and while searching web to find out how to grep it, I just wonder 'Is it right how I understand about Ext.define() and Ext.create()? and why many people are using Ext.define() method even they not use again and not for inheritance?'
please advice me to understand fundamentals of Extjs.
Thanks!