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

求教 extjs4 点击树节点 新建tab并加载不同的grid
本帖最后由 blanksoil 于 2012-07-24 17:35:44 编辑
//点击树节点,中间的tabpanel新建一个对应的tab
west_chem.on('itemclick',function(view,record,item,index,e){
        var cen_tabs = Ext.getCmp("cen_tabPanel");
        if(record.raw.leaf){
            e.stopEvent();  
            var addnew = cen_tabs.getComponent(record.raw.id);
            var id = record.raw.id;
            if(!addnew){
                addnew  =  cen_tabs.add({
                    itemId : record.raw.id,
                    title: record.raw.text,
                    autoScroll:true,
                    closable:true,
                    closeAction:'close',
                    items:[inorg_all_grid],     //每个panel加载的grid不同,要怎么做?
                    dockedItems: [{
        dock: 'top',
        xtype: 'toolbar',
        items: [ '->',  {
           xtype: 'textfield',
           fieldLabel:'查询条件',
           name: 'searchBy'
        }, {
           xtype: 'button',
           text: '搜索'
        },{
           xtype: 'button',
           text: '增加',
           }
        }]
     }]
                 }).show();
            }
        
            cen_tabs.setActiveTab(addnew);  
         }
         
   });


------解决方案------------------