当前位置:编程学习 > JAVA >>

ext4 关于treepanel 和tabpanel 混合使用 beforeclose 监听不好使的问题

 var item3 = Ext.create('Ext.tree.Panel', {
             store: knowledgeModel,
             border: false,
             cls:'empty',
             height: 500,
             dockedItems: [{
            xtype: '易做图',
            items: [{
                text: '展开树图',
                setTitle: '展开树图',
                handler: function(){
                    item3.expandAll();
                }
            }, {
                text: '收起树图',
                title: '收起树图',
                handler: function(){
                    item3.collapseAll();
                }
            },{
             text: '刷新树图',
                handler: function(){
                    knowledgeModel.load();
                }
            }]
        }],
        listeners: {
        beforeitemdblclick:function(view,record,item, index,  e,  eOpts ){
             //双击组打开新的Tab
             if(!Ext.Array.contains(pubTabArray,record.data.id)){
             addTab(true,record.data.qtip,record.data.id,true);
             pubTabArray.push(record.data.id);
             }else{
             var arrayList = viewport.down('#tabs').items.items;
             for(var i=0;i<arrayList.length;i++){
             if(arrayList[i].title == record.data.qtip){
             viewport.down('#tabs').setActiveTab(arrayList[i]);
             }
             }
             }
             }
     }
            
            });

var tabs = Ext.createWidget('tabpanel', {
        activeTab: 0,
        defaults :{
            bodyPadding: 10
        },
        itemId:'tabs',
    });

function addTab (closable,qtip,tabId,pubFlag) {
        tabs.add({
            title: qtip,
            iconCls: 'public_group',
            html: 'Tab Body ',
            closable: !!closable,
            listeners: {
beforeadd: function(tabPanel, component, index, eOpts){
  alert(123);
},
                beforedestroy: function(){
                alert(890);
                }
}
            
        }).show();
    }

这里用beforedestroy 就好用, beforeclose 就不好用 为什么啊   
还有那个beforeadd 也不好用。 --------------------编程问答-------------------- 顶一下,还没做到这一步。等高人给答案
补充:Java ,  Java SE
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,