1. #1
    Sencha User
    Join Date
    Nov 2007
    Posts
    61
    Vote Rating
    0
    vendiddy is on a distinguished road

      0  

    Default xtypes for everything?

    xtypes for everything?


    I really like how ExtJs 2.0 started using xtypes for lazy instantiation of components.

    Are there any plans to introduce xtypes for every (or almost every) object? That way, it would be possible to instantiate a complex object solely with json. This makes it extremely easy to store most of the logic on the server.

    For example, if I create a GridPanel, in the config, I need might declare it something like this:
    PHP Code:
    grid = new Ext.grid.GridPanel({
        
    selModel: new Ext.grid.RowSelectionModel({singleSelecttrue}),
        
    store: new Ext.data.Store({
            
    reader: new Ext.data.JsonReader(/*config*/)
        }),
        
    columns: [
            
    //columns here...
        
    ],
        
    renderTodocument.body,
        
    height400
    }); 
    If all (or most) of the objects had xtypes, then I could do something like this:
    PHP Code:
    grid = new Ext.grid.GridPanel({
        
    selModel: {
            
    xtype'rowselectionmodel',
            
    singleSelecttrue
        
    },
        
    store: {
            
    xtype'store',
            
    reader: {
                
    xtype'jsonreader'
                
    /*...jsonreader config..*/
            
    }
        },
        
    columns: [
            
    //columns here...
        
    ],
        
    renderTodocument.body,
        
    height400
    }); 
    The power in this is that I could pretty much get the entire grid config from the server without any additional abstractions/wrappers.

    What are everyone's thoughts on this?
    Last edited by vendiddy; 18 Jan 2008 at 12:13 PM. Reason: typo

  2. #2
    Sencha User
    Join Date
    Nov 2007
    Posts
    61
    Vote Rating
    0
    vendiddy is on a distinguished road

      0  

    Default


    Bump.

    No one has any thoughts on a feature like this? I don't think it would necessitate an overhaul. The ComponentMgr would be modified to work with any object (not just components).

    When an object is instantiated, it can check whether the xtype property is set for certain config options. If it is, the ComponentMgr can be used to get the object and instantiate it.

    Just a suggestion.

  3. #3
    Ext JS Premium Member
    Join Date
    Mar 2007
    Location
    NL
    Posts
    608
    Vote Rating
    1
    mdissel is on a distinguished road

      0  

    Default


    Yes! Very good suggestion!

    but at the moment only bugfixes are added to svn... (this is a remark for a different thread , although after a long break today there was a commit to svn from Jack)

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,176
    Vote Rating
    119
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    vendiddy -

    At this point only Components can use xtypes. It would be difficult to support constructor's which have more than a single config option. But, essentially any constructor that follows this single argument pattern should be able to be registered and created with the ComponentMgr. I will note this as a request and we will look into the possibility of extending the lazy-instantiation style even further.

    Thanks,
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  5. #5
    Ext JS Premium Member
    Join Date
    Mar 2007
    Location
    NL
    Posts
    608
    Vote Rating
    1
    mdissel is on a distinguished road

      0  

    Default


    Any news on this feature request?

  6. #6
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,176
    Vote Rating
    119
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    It's on the list of things that we are considering. At this point xtypes will only work with components because they have a consistent constructor API (a one argument config which gets applied to the new object immediately at creation time).

    Perhaps an ordered arguments array for classes which don't fit into this pattern would work well.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  7. #7
    Ext JS Premium Member
    Join Date
    Mar 2007
    Location
    NL
    Posts
    608
    Vote Rating
    1
    mdissel is on a distinguished road

      0  

    Default


    Yes, and a lot of code changes.. like in:
    TreePanel.initComponent()
    if(this.root){
    this.setRootNode(this.root);
    }

    basically in every initcomponent that contains a reference to / new instance of another Ext object..

  8. #8
    Ext User eccehomo's Avatar
    Join Date
    Sep 2007
    Location
    Davao City, Philippines
    Posts
    98
    Vote Rating
    0
    eccehomo is on a distinguished road

      0  

    Default


    Yep. This feature seems sensible and just natural. To me, Component is a class. Ext.data.Store is a class. Why not have xtypes for both?

    Even if this feature is not implemented, I certainly detest the idea of implementing another 'types' (e.g 'ptypes' - types for plugins). It's needless and redundant just as creating a new surrogate key in a given relation (or "table"). xtypes fully encapsulates the identification (for purposes of lazy instantiation and declared class definition) of classes.

    Currently, Components are aware of xtypes when it is passed in the 'items' config:
    Code:
    var a = new Ext.Component({
    items : [{
    xtype : 'a'
    }, {xtype : 'b']
    store : a //oops, cannot detect xtype for this config
    })
    of course, this would mean lots of changes.

  9. #9
    Sencha User
    Join Date
    Mar 2010
    Posts
    83
    Vote Rating
    -1
    daiei27 is an unknown quantity at this point

      0  

    Default


    +1

    Great idea! Would save me a lot of trouble as I'm considering xtype-ing more of my Ext code (as it sounds like more and more people are doing).

  10. #10
    Ext JS Premium Member
    Join Date
    May 2008
    Posts
    528
    Vote Rating
    0
    Eric24 is on a distinguished road

      0  

    Default


    +1

    I regularly register Ext classes (where possible) as xtypes in my "Ext Overrides" file. I find using xtypes and lazy instantiation to be much cleaner and easier.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi