GeoExt2 - Popup Bug?

时间:2012-12-21 10:00:27

标签: javascript popup openlayers

我现在正在使用GeoExt2(alpha)+ Extjs 4.1来实现地图应用程序。有时候,当我在地图上选择一个功能时,会显示两个弹出窗口。屏幕底部有一个信息正确,一个在正确的地方空。即使我把它关闭也不行。我想知道这是不是一个错误?

myLayer.events.on({
 featureselected: function(e) {
 createPopup(e.feature);
 },
  featureunselected: function(){
  popup.destroy();
 }
});





function createPopup(feature) {

    popup = Ext.create('GeoExt.Popup', {
    id: 'popup',
        title: title,
        location: feature,
        });


         popup.on({
            close: function() {
                if(OpenLayers.Util.indexOf(myLayer.selectedFeatures,
                                           this.feature) > -1) {
                    selectControl.unselect(this.feature);
                }
            }
        });

    PopupTab = Ext.create('Ext.tab.Panel', {
    id: 'PopupTabs',
        activeTab:2,

    items: [
        { 
            title: 'Supervisor',
            itemId: 'tab1',
        },
        { 
            title: 'student',
            itemId: 'tab2',

            items: [
                { 
                xtype: 'label',
                id: 't',
                html: content,
                layout: 'fit',
                                cls:'tabStyle'
                }
            ]
        },


    ],
    listeners: {
        tabchange: function(panel, tab) {
            if (tab.popup !== undefined) { // show window after tab change
                tab.popup.show();
            }
        }
    }
});

        popup.add(PopupTabs);

        popup.show();

    }

0 个答案:

没有答案