1. #1
    Ext User
    Join Date
    Sep 2010
    Posts
    2
    Vote Rating
    0
    Luca D'Antona is on a distinguished road

      0  

    Default How to define and instantiate a new class

    How to define and instantiate a new class


    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

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,648
    Vote Rating
    583
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Have a look at the Ext source, it shows exactly how to create classes.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Ext User
    Join Date
    Sep 2010
    Posts
    2
    Vote Rating
    0
    Luca D'Antona is on a distinguished road

      0  

    Default


    Quote Originally Posted by evant View Post
    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?

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,648
    Vote Rating
    583
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    No, one of the files where it creates a class, just have a look through a few of them.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Similar Threads

  1. Dynamically instantiate a class
    By bkraut in forum Ext 3.x: Help & Discussion
    Replies: 7
    Last Post: 28 Sep 2009, 3:13 AM
  2. Why can't I define a view in a pre-configured class
    By bernd01 in forum Ext 2.x: Help & Discussion
    Replies: 11
    Last Post: 10 Mar 2009, 9:38 AM
  3. what class define html?
    By hchen in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 30 Jun 2008, 7:42 AM
  4. Define class on ajax call
    By marco76 in forum Ext 2.x: Help & Discussion
    Replies: 11
    Last Post: 15 Jan 2008, 4:13 AM
  5. How to instantiate an object of the same class as "this"?
    By mherger in forum Ext 1.x: Help & Discussion
    Replies: 4
    Last Post: 24 May 2007, 12:05 PM

Thread Participants: 1