Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are differences between Ext.create() and Ext.define() in SenCha Touch

I have been learning SenCha Touch for awhile and still feel confused when trying to create a store.

In the SenCha Documentation, it says to use Ext.create() Example I tried and it simply doesn't work.

For the rest of others, I always see people use Ext.define() to create a store and it works.

Now, my question is: what are the differences between them and when/how to use either one of them in a right way?

Some demo code is highly appreciated

Thanks a lot my friends.

like image 769
Franva Avatar asked Apr 11 '14 04:04

Franva


People also ask

What is difference between ext create and ext define?

Ext. create - to create an instance of a pre-defined class. - the class was defined using Ext. define - used to define the data and behavior of a component.

What is Sencha Ext JS?

Sencha Ext JS is the leading standard for business-grade web application development. Ext JS provides the tools necessary to build robust applications for desktop and tablets. Streamlines cross-platform development across desktops, tablets, and smartphones - for both modern and legacy browsers.

Which is the root class of all class created with ext define?

The root of all classes created with Ext. define. Ext. Base is the building block of all Ext classes.

Is Sencha Ext JS free?

It is a free, limited commercial use license, with robust Ext JS Frameworks, hundreds of modern components, a material theme, and more to develop stunning-looking apps.


1 Answers

define is for declaring a class.

Ext.define('Foo', {
    extend: 'Bar'
});

// Similar to:
public class Foo : Bar {
}

create is for creating an instance:

var o = Ext.create('Foo'); // Can also have var o = new Foo();

// Similar to:
Foo o = new Foo();
like image 195
Evan Trimboli Avatar answered Sep 24 '22 16:09

Evan Trimboli