日期:2014-05-16  浏览次数:20497 次

extjs 创建多个实例

?

Ext.onReady(function() {
    var html = '<p>测试数据.</p>';
    
    var configs = [{
        title: 'Basic Panel',
        collapsible:true,
        width:400,
        html: html
    },{
        width: 320,
        height: 320,
        title: 'Masked Panel with a really long title',
        bodyStyle: "padding: 5px;",
        html: 'Some content',
      
    }];
    
    Ext.each(configs, function(config) {   //循环迭代 configs 
        var element = Ext.getBody().createChild({cls: 'panel-container'});//创建一个子窗口
        
        Ext.createWidget('panel', Ext.apply(config, {
            renderTo: element,
            bodyPadding: 7
        }));
    });
});