1. #1
    Sencha User
    Join Date
    Nov 2012
    Location
    Mauritius
    Posts
    43
    Vote Rating
    3
    Shabneez is on a distinguished road

      0  

    Default Ext.define and Ext.create

    Ext.define and Ext.create


    Hello,

    I understand that Ext.create will create an object of the class, however in sencha architect i find only Ext.define. Could someone please tell me why we don't have Ext.create? Thanks

  2. #2
    Sencha User
    Join Date
    Aug 2011
    Location
    London
    Posts
    409
    Vote Rating
    18
    digeridoopoo will become famous soon enough

      1  

    Default I think...

    I think...


    If I remember from when I tested it last (and please correct me if I'm wrong) you can only use Ext.Create in Architect in functions of the class....e.g. the init function, painted etc. You can also use it as an override if you override that class

  3. #3
    Sencha User jjohnston's Avatar
    Join Date
    Sep 2010
    Posts
    567
    Vote Rating
    20
    jjohnston will become famous soon enough jjohnston will become famous soon enough

      1  

    Default


    Digeridoopoo's reply is correct. Architect is all about defining a set of classes and configurations. It's possible that within your own custom event handlers or controller logic you'll need to instantiate those classes, but it's up to you to write that logic.
    Jason Johnston
    @lojjic
    Sencha Architect Development Team

  4. #4
    Sencha User
    Join Date
    Nov 2012
    Location
    Mauritius
    Posts
    43
    Vote Rating
    3
    Shabneez is on a distinguished road

      0  

    Default


    Hello,

    Thanks for the replies. Actually that part I understood..what I was asking is that, when we are defining anything, it is just there, right? No instance of the object is created yet..then how are we able to see it?

  5. #5
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    North Carolina
    Posts
    307
    Vote Rating
    18
    worthlutz will become famous soon enough

      0  

    Default


    Quote Originally Posted by Shabneez View Post
    ..then how are we able to see it?
    Think about it this way...

    You drag a panel to the project inspector, name it "MyPanel", add useralias "mypanel" and define all the configs. You now have a class and can use this top level object by dragging it into another container or panel or viewport and then choose link. This creates the instantiated object in the containing object.

    The link will use the user alias as xtype in the items array of the container.
    Code:
     items: [
        {
            xtype: "mypanel",
            height: 100,
            width:  200,
            ... more configs...
        }
    This is the instantiated object you will see. You can change some configs in the link to override the ones in the class you created.

    Generally the first panel you drag becomes the initial view.

    I hope this quick explaination makes sense.

    Worth