Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm using GeoExt2 (alpha) + Extjs 4.1 now to implement a map application. The thing is sometimes when I select a feature on the map, two popups are displayed. one at the bottom of the screen which has correct info and one empty in the right place. it doesn't go even I close it. I wonder if this is a bug ?

EDIT

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();

    }
share|improve this question
    
Post your code, otherwise it's impossible to know if it's a GeoExt bug or a mistake in your code. –  Pablo Dec 20 '12 at 19:05
    
Updated my post –  Shadin Dec 21 '12 at 9:53
add comment

1 Answer

up vote 0 down vote accepted

Since the example on the GeoExt2 works, I think the problem is in your code. There are a few things you may try:

  • Don't assign an id to the popup, Sencha guys tells that is not a good idea to do that, specially for window container, if you really need a reference to use with the Ext.ComponentQuery use other property instead, like 'name' or 'itemId' or a custom one like 'foo'.

  • Check the select control configurations, it may be firing the selection twice.

  • set anchorPosition: 'auto'

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.