PDA

View Full Version : How to define and instantiate a new class



Luca D'Antona
1 Sep 2010, 2:57 AM
Hi all,

I'm new to ExtJS and I would like to know how to create a new class.
I'm used to Prototype, where I used to write something like:

/* DEFINITION */
Test = {};

Test.c = Class.create();
Test.c.prototype = {
initialize: function() {
...constructor...
},
...
...
};

/* INSTANTIATION */
var MyTest = new Test.c();

Is it possible to do something similar with ExtJS?

Thank you,
Luca

evant
1 Sep 2010, 3:00 AM
Have a look at the Ext source, it shows exactly how to create classes.

Luca D'Antona
1 Sep 2010, 4:34 AM
Have a look at the Ext source, it shows exactly how to create classes.

Do you mean the file ext-3.2.1.zip\ext-3.2.1\src\ext-core\src\core\Ext.js?

evant
1 Sep 2010, 4:46 AM
No, one of the files where it creates a class, just have a look through a few of them.