PDA

View Full Version : [FIXED] LIsten map events inside a controller



FidoX
5 Nov 2011, 6:03 AM
Hello, I can't be able to listen for the maprender event using the control() method inside a controller. It works for other events but not for the maprender. On the other side, if I listen for the event in the map object itself it works.

This is the code that doesn't work:


Ext.define('Test.controller.MainController', {
extend: 'Ext.app.Controller',


init: function() {
console.log('init controller');


this.control({
'map': {
maprender: function() {
console.log('the map render');
}
}
});
}
});


Ext.application({
name: 'Test',
controllers: ['MainController'],

launch: function() {

Ext.create('Ext.Container', {
layout: 'card',
fullscreen: true,
items: [{
xtype: 'map',
}]
});
}
});



Im using chrome to testing with Sencha Touch 2.0.0 Preview Release 1

Anybody have the same issue?

Greetings.

rdougan
5 Nov 2011, 8:47 PM
This is a bug with the Map component. The maprender event gets called when the component is constructed, which is incorrect. This also means that it gets called immediately, which is too late for the .control method in your controller.

FidoX
6 Nov 2011, 5:03 AM
Ok, by now I can get it working using the activate event instead.

Jamie Avins
29 Nov 2011, 12:00 PM
This issue has been resolved for the next release.