1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    16
    Answers
    1
    Vote Rating
    0
    corneadoug is on a distinguished road

      0  

    Default Unanswered: Add xtype components to a custom container component

    Unanswered: Add xtype components to a custom container component


    Hi,

    I have a lot of nested container, and some can be reused in different par of my project, so I was thinking of making a custom components out of it. (Kinda view like component)

    The purpose is the same than for website template: only a small part can change.

    So I made this:

    Code:
    Ext.define('com.nflabs.peloton.web.PopUp', {    extend: 'Ext.window.Window',
        
        config : {
        },
        
        constructor: function(config){
            this.callParent(arguments);
            this.initConfig(config);
            return this;
        },
        
        initComponent : function(){
            
            Ext.apply(this, {
                
                layout: {type : 'vbox', align: 'stretch'},
    
    
                style: 'padding: 10px;',
                modal : true,
                draggable: false,
                constrain: true,
                resizable: false,
                bodyCls: 'innerWindow',
                
                items : [
                               {
                                 xtype: 'container',
                                 autoScroll: true,
                                 width : 550,
                                 minWidth : 350,
                                 minHeight : 140,
                                 layout: {type : 'vbox', align : 'stretch'},
                                 style: 'background-color:blue;padding-bottom: 20px; padding-left: 20px; padding-right: 20px; margin-top: 20px;',
                                 items: [
                                         this.content
                                 ]
                               }
                ]
            });
            
            
            this.callParent(arguments);
        }
    });
    and I call it like that:

    Code:
    this.settingWindow = Ext.create("com.nflabs.peloton.web.PopUp",{            
                contentWidth: 550,
                content : [
                            {
                                xtype : 'label',
                                text : "Please select widget to add"
                                
    }]
    });
    However nothing happened. I realized that is the content is in xtype Json kinda format, it doesn't build the object, when If I build the label with Ext.create() it works.

    Since the basic items: [] of a component can accept xtype Json, how can I do it too?

    Thank you

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,795
    Answers
    3466
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Let's look what your doing. You are trying to pass in an array of items via the content config. You are trying to use that content within the items array. So you are having an array within an array. So instead of this:

    Code:
    items : [
        this.content
    ]
    do this:

    Code:
    items : this.content
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

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