Threaded View

  1. #1
    Sencha User
    Join Date
    Mar 2013
    Posts
    20
    Vote Rating
    0
    Vishvesh is on a distinguished road

      0  

    Default Answered: Calculating portal columns to add portlets dynamically per Tab

    Answered: Calculating portal columns to add portlets dynamically per Tab


    Hello guys,
    Is there a way I can get rid of the 'id:col-0', 'id:col-1', and so on, so that I can add a panel dynamically inside the tab, which is essentially a portalpanel?


    Code:
    items: [{
                title: 'Tab 1',
                items: [{
                    id: 'app-portal-1',
                    xtype: 'portalpanel',
                    region: 'center',
                    flex: 1,
                    columnWidth: 0.2,
                    items: [{
                        id: 'col-0',
                        //items: [getSavedUserPortlets() ? getSavedUserPortlets() : []]
                        items: []
                    },{
                    id: 'col-1',
                    items: []                
                 },
                 {
                     id: 'col-2',
                     items: []                
                  }
                    ]
                }
                ]
            },
            {
                title: 'Tab 2',
                items: [{
                    id: 'app-portal-2',
                    xtype: 'portalpanel',
                    region: 'center',
                    flex: 1,
                    columnWidth: 0.5,
                    items: [{
                        id: 'col-3',
                        items: []
                    },{
                    id: 'col-4',
                    items: [{
                        id: 'stock-portlet-'+count,
                        title: 'Stock Portlet',
                        width: 20,
                        tools: getTools(),
                        items: Ext.create('Ext.app.ChartPortlet'),
                        closable: true
                    }]                
                 },
                 {
                     id: 'col-5',
                     items: []                
                  }
                    ]
                }
                ]
            }]
    I am actually adding new portlet panels by using this :
    Code:
    Ext.getCmp(this.defaultPortalColumn).add(portlet);
    My defaultPortalColumn is col-0 in this case.

    For 1 tab, everything works perfect. But I have several tabs.

    But say I want to add the same portletPanel in Tab 2's 1st column.
    Now, I am setting the id of the portalPanel everytime(So a Div with that id is created in the DOM). What is the best / efficient way to avoid duplicate id's in the DOM or how should I go by adding the portletPanels in other tabs, without any error / duplications?

  2. Code:
    Ext.ComponentQuery.query('#app-portal-1 panel')
    will return an array with three panel in it

    so try

    Code:
    Ext.ComponentQuery.query('#app-portal-1')[0].add();

Thread Participants: 1

Tags for this Thread

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