PDA

View Full Version : Ext.Map panel returns undefined



KarmaKoder
16 Apr 2011, 9:57 AM
Hi, I'm trying to visualize a map. :-?

I included in my index.html the following line:


<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>

the same file includes


<script src="javascripts/index.js" type="text/javascript" charset="utf-8"></script>

that includes the following code:


...
ListDemo.mapPanel = new Ext.Panel({
id: 'mappanel',
fullscreen: true,
items: [{
xtype: 'map',
useCurrentLocation: false
}
],
dockedItems: [ListDemo.mapToolbar]
});
...

I am able to render the panel but there is no map, just the dockedItem and the word "undefined" on a white background.

I downloaded the latest sencha today and I'm testing my app with Xcode and an iPhone Simulator 4.1 (so, not on a real phone).

What am I doing wrong? 8-|

Thanks a lot

KarmaKoder
16 Apr 2011, 4:46 PM
the problem was that I was updating the map panel every time the user clicks on a toolbar button. I had no idea that updating a panel that has already been created would give this problem.

I'm still confused about WHAT was undefined, what is the best way of debuggin that? Or in general, what is the best way of debugging my app? I see that if there is an error in the js the simulator shows a blank page, right now I have no idea how to find the error in my js other than retracing my steps.