0

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

    }
2
  • Post your code, otherwise it's impossible to know if it's a GeoExt bug or a mistake in your code.
    – Pablo
    Commented Dec 20, 2012 at 19:05
  • Updated my post
    – Shadin
    Commented Dec 21, 2012 at 9:53

1 Answer 1

0

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'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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