Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extjs component inside Ext.XTemplate on EXTJS 4

I'm trying to add extjs components to tpl panel. Is there anyway to insert component to tpl like this

Ext.create('Ext.panel.Panel',{ 
    renderTo: Ext.getBody(), 
    data: {},  
    listeners:{
        afterrender:function(){
            var renderSelector = Ext.query('div.comment-add-textarea'); 
                for(var i in renderSelector){
                    Ext.create('Ext.form.field.TextArea',{
                        height:300,
                        renderTo:renderSelector[i]
                    });   
                } 
        }
    },
    tpl: Ext.create('Ext.XTemplate',
        '<tpl for=".">',
        '<div class="comment-add-textarea"></div>',
        '</tpl>',{
          compiled:true
        })
});​
like image 642
XenoN Avatar asked May 18 '12 09:05

XenoN


1 Answers

Try this

Ext.create('Ext.panel.Panel', {
    renderTo: Ext.getBody(),
    data: {},
    listeners: {
        refresh: function() {
            var renderSelector = Ext.query('div.comment-add-textarea');
            for (var i in renderSelector) {
                Ext.create('Ext.form.field.TextArea', {
                    height: 300,
                    renderTo: renderSelector[i]
                });
            }
        }
    },
    tpl: Ext.create('Ext.XTemplate',
        '<tpl for=".">',
        '<div class="comment-add-textarea"></div>',
        '</tpl>', {
            compiled: true
    })
});
like image 83
arshabh Avatar answered Sep 21 '22 17:09

arshabh