简体   繁体   中英

Sencha Touch 2: Ext.Map control show event will not fire

I have a control in which I have extended an 'Ext.Map'. Everything works fine and it loads fine, using my current location.

The thing that does not work is the 'show' event is never fired. I have tried overloading it in a controller:

Ext.define('MyApp.controller.Map', {
    extend: 'Ext.app.Controller',

    config: {
        refs: {
            myMap: 'myMap'
        },
        control: {
            myMap: {
                show: 'onMyMapShow'
            }
        }
    },

    onMyMapShow: function(myMap, eOpts) {
        // never enters this function...
    }
});

...as well as in the control itself:

Ext.define('MyApp.view.MyMap', {
    extend: 'Ext.Map',
    xtype: 'myMap',

    config: {
        layout: 'fit',
        useCurrentLocation: true,

        listeners: {
            show: function() {
                // never enters this function either...
            }
        }
    }
});

Nothing seems to work. How do I get the show event to fire? When is it expected to fire?

That is because the show event is not fired when the show() function is called.

If you want to execute some code when your map is shown then you need to listen to the maprender or painted event.

Hope this helped.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM