PDA

View Full Version : ExtJS and IFrame window events



Shehul
22 Feb 2012, 1:17 PM
Hello ExtJS community/Support team,

I have a center panel which uses IFrame to load some map like google map

the html is like below,

'<iframe id="mapframe" name="mapframe" src="MySrc" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>'

Now I want to capture the event which will describe me that the above frame is completely loaded,

I tried using afterrender (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.AbstractComponent-event-afterrender) and afterlayout (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.container.AbstractContainer-event-afterlayout) events but they are getting fired even before the map is completely loaded or shown to user.

On this events I have just put
console.log(' I am done with map');
but I see this message before the map has been loaded.

Can someone point me to correct event I should be using for Panel.

There is other GUI load logic I need to put if this frame is completely loaded or else my program should wait until map loaded.

Complete code is as below.

var centerpanel = Ext.create('Ext.Panel',
{
region : 'center',
id : 'centerwin',
titleCollapse : true,
layout : 'fit',
border : false,
height : 900,
width : '100%',
maxWidth : window.screen.width - 2,
html : '<iframe id="mapframe" name="mapframe" src="MySrc" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>',
listeners :
{
'afterrender' : function()
{
console.log(' I am done with map');
}
}
}
);

Thanks,
Shehul

mitchellsimoens
22 Feb 2012, 1:36 PM
Why not use the gmappanel? You can see a demo if you go into the examples/window/gmap.html

Shehul
22 Feb 2012, 2:03 PM
Hi mitchellsimoens (http://www.sencha.com/forum/member.php?22216-mitchellsimoens),

Thanks for reply however I mentioned I am not using Google , I just gave example that I am loading a map like Google, basically I am using Openlayer map(http://openlayers.org/)(I thought not many people would know about this and that's why mentioned google).

Coming back to my post and your reply,

First I didn't find the example as you mentioned for gmappanel , may be I can use but I need to see its working and need to see is it allowing map other than google or not.

I googled as well for gmap panel example , I got the source code but not working demo of the gmap panel.

Anyway from your knowledge do you know Gmap panel allows to use map other than google map or not. If it does, send me working example link for this panel and I will mark your answer as best answer.

But in case gmap doesn't allow other map than my thread should be still open.

Thanks,
Shehul



Why not use the gmappanel? You can see a demo if you go into the
examples/window/gmap.html

Shehul
22 Feb 2012, 2:07 PM
Hi mitchellsimoens (http://www.sencha.com/forum/member.php?22216-mitchellsimoens),

Never mind the link found the example (it was under misc.._).

Checking the code and if I can use I will come back with marking your answer.

Thanks,
Shehul


Hi mitchellsimoens (http://www.sencha.com/forum/member.php?22216-mitchellsimoens),

Thanks for reply however I mentioned I am not using Google , I just gave example that I am loading a map like Google, basically I am using Openlayer map(http://openlayers.org/)(I thought not many people would know about this and that's why mentioned google).

Coming back to my post and your reply,

First I didn't find the example as you mentioned for gmappanel , may be I can use but I need to see its working and need to see is it allowing map other than google or not.

I googled as well for gmap panel example , I got the source code but not working demo of the gmap panel.

Anyway from your knowledge do you know Gmap panel allows to use map other than google map or not. If it does, send me working example link for this panel and I will mark your answer as best answer.

But in case gmap doesn't allow other map than my thread should be still open.

Thanks,
Shehul