PDA

View Full Version : [FIXED-207] Ext.Map: wrapped map unavailable in afterRender



cnelissen
9 Aug 2010, 1:18 PM
There are currently some deficiencies with the Map component, specifically there is no way to know when/if the map (the wrapped map) is currently rendered and available. For instance, if you execute the following code, you will see that the map is still unavailable in the afterRender event. It should seem that afterRender would be the last stop for the component and everything should be rendered and available.



<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Map Test</title>

<link rel="stylesheet" type="text/css" href="../../resources/css/ext-touch-debug.css" />
<script type="text/javascript" src="../../ext-touch-debug.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript">
Ext.setup({
onReady: function() {
new Ext.Map({
listeners: {
'afterRender': function() {
//console.log(this);
console.log(this.map);
}
}
}).show();
}
});
</script>
</head>

<body>
</body>
</html>


This causes problems with things such as adding markers to a map if the component is not rendered at runtime. I think either the map needs to be made available sooner, such as in the 'render' method, or we need a separate event such as 'mapRendered' to start adding markers and such.

Thoughts?

Jamie Avins
10 Aug 2010, 7:45 AM
Thank you for the report.

evant
8 Sep 2010, 7:05 PM
In 0.94 there is a new maprender event that fires when the map is ready for use.