1. #1
    Ext User
    Join Date
    Apr 2008
    Posts
    21
    Vote Rating
    0
    Philippe_Fery is on a distinguished road

      0  

    Thumbs up Dynamic component instatiation via xtype

    Dynamic component instatiation via xtype


    Hi!

    I created a new class. This class has 3 subclasses. Each of them is registered using

    Code:
    Ext.reg(xtype, cls)
    I have a tree in the left pane of my ViewPort (border layout). This tree contains nodes. Depending on the node type the user clicked on, I must display the node data in a specific grid (i.e. in a grid which will be placed in an Ext.Panel with card layout).

    The xtype of the three subclasses xtype are: "datagrid_P", "datagrid_D", "datagrid_DT".

    When I click on a node, I get the xtype suffix (let's say "_P") and I can build the xtype to be used to instantiate the right datagrid (i.e.: "datagrid_P").

    How can I dynamically instantiate the right datagrid using the xtype?

    I tried things like:

    Code:
      function activateDatagrid(nodeType){
        xtypeValue = 'datagrid_'+nodeType;
        activeDatagrid = {xtype: xtypeValue};
        ...
      }
    But it doesn't work...


    Any idea?

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,499
    Vote Rating
    47
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Ext.ComponentMgr.create(config) will examine the xtype and use the registered constructor.

    It's commented as private, but I really cannot see a reason for that. I'll add doc comments to it to make it public. I use this method all the time!

  3. #3
    Ext User
    Join Date
    Apr 2008
    Posts
    21
    Vote Rating
    0
    Philippe_Fery is on a distinguished road

      0  

    Default


    Thank you for your help!

    I try it so far!

    ;-)

  4. #4
    Ext User
    Join Date
    Apr 2008
    Posts
    21
    Vote Rating
    0
    Philippe_Fery is on a distinguished road

      0  

    Default


    Great!

    It works fine!

    Thank you again.

  5. #5
    Sencha User
    Join Date
    Nov 2007
    Posts
    243
    Vote Rating
    0
    JamesC is on a distinguished road

      0  

    Default


    Really useful thing to know, cheers again Animal. Very useful for my dynamic form generation using database configuration!

  6. #6
    Sencha User
    Join Date
    Jun 2012
    Posts
    18
    Vote Rating
    0
    altanmur is on a distinguished road

      0  

    Default Hello

    Hello


    Please example.
    I have a same problem little different.

    [CODE]
    for(i in name){...
    .....
    var module = 'CarOrder.view.module.' + name[i];
    /* 1st // me.addDocked(
    // Ext.create(module,{
    // id: me.id,
    // selectedCompObj: sco
    // })
    // );
    */
    /* 2nd
    // var toolbarObj = Ext.create('CarOrder.view.module.ToolbarEvents',{
    // id: me.id,
    // selectedCompObj: sco
    // });
    // this.dockedItems.push(toolbarObj);
    */
    /* 3rd
    // me.dockedItems.push(
    // Ext.create(module,{
    // selectedCompObj: sco
    // })
    // );
    */
    /* 4th
    //var toolbarObj = { // xtype: name,
    // id: me.id,
    // selectedCompObj: sco
    //};

    // me.dockedItems.push(toolbarObj);
    */
    /* 5th
    //var toolbarObj = Ext.create('CarOrder.view.module.ToolbarEvents',{
    // id: me.id,
    // selectedCompObj: sco
    //};

    // me.dockedItems[i] = toolbarObj;
    */

Thread Participants: 3

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