PDA

View Full Version : Basic Question - extjs4. Ext.create vs Ext.define



kumar_Rajesh78
13 Feb 2014, 2:47 PM
Dear Experts,
I am new to Extjs4. Currently learning it by experimenting and going through some tutorials. I have this very basic question.
I would like to understand the what is the difference between Ext.create and Ext.define.

I am wondering why my page works fine even without using Ext.create. I have just defined my Controller, views, models etc by using Ext.define and not created them anywhere explicitly using Ext.create, but still all the views are rendered correctly.

Could you please explain the difference and usage of these two.
I would highly appreciate it.

Thanks,
Rajesh

scottmartin
13 Feb 2014, 3:12 PM
Ext.create creates an instance.
Ext.define defines the class itself

You can create an instance of a class at anytime.
In the MVC pattern, the instances are created based on your array setups



views : [ 'MyView' ] // creates an instance of that view
store : [ 'MyStore' ] // creates an instance of store

kumar_Rajesh78
13 Feb 2014, 3:41 PM
Thanks Scott,
That was what I was looking for.

Thanks for the explanation.
Rajesh