View Full Version : Javascript running on a new tab page..problem!
mfw24
21 Jul 2007, 11:03 AM
I have an layout that has a grid within the center pannel. WHen i double click on an item in the grid, it opens up a new tab. The tab is called to open up a new page. That page has some static html and javascript on there. It does not appear that the javascript is working when it opens within a ext tab. Would anyone know why this is?
btw...the page works fine when i call it outside of ext.
Thanks!
jay@moduscreate.com
21 Jul 2007, 1:53 PM
I have javascript running in iframes embeded in content panel tabs. Are you using firebug to debug what's going on? Is the javascript being loaded? Without code/example of your problem we can't do too much to assist.
DigitalSkyline
21 Jul 2007, 3:22 PM
If you're not using an iframe, then the javascript must be inline code. Also the scope of the code will not be the top level (window) it will be executed (eval'd) under an Ext namespace. You need to take this in consideration when designing your app.
mfw24
22 Jul 2007, 6:38 AM
Thanks to both of you for your responses!! I really appreciate any help you can provide.
The code I have written to create a new tab once the grid is double clicked is this (i'm using div):
---------------------------------------------
function createCenterTab(title, id){
var newCenterTabId = id;
Ext.DomHelper.insertAfter('center2', {
tag: 'div'
,id: newCenterTabId
},true)
//Note that "center2" is Id of the main panel in center region.
layout.beginUpdate();
layout.add('center', new Ext.ContentPanel(newCenterTabId, {title: title, closable: true}));
layout.endUpdate();
//return the id of new panel
return newCenterTabId;
}
-----------------------------
You mentioned that it will be excecuted under an EXT namespace. Can you please help me understand or point me in the right direction towards understanding the consequences of this and how to program accordingly?
Thanks
mfw24
22 Jul 2007, 6:44 AM
btw..this is what i see within firebug as the response when opening up a new tab
-----------------------------
<script type="text/javascript" src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=MUA4d6vV34GJHim6JciryOGm8il6upqlGrkrmiwou_bHFN28xAPmxU_C2Z8-"
> </script> <b>Offender Name:</b> JUSTIN D<br><br><b>Date of Birth:</b> 10/03/1986 (20 years old)<br><br><b>Move Date:</b> 03/2007<br><br><b>Address:</b> 2561 NW 14TH CT<br><br> <b>City:</b> FORT LAUDERDALE<br><br> <b>State:</b> FL<br><br> <b>Zip Code:</b> 33311<br><br><b>Offense Information:</b> <br>-<br>-COURT ORDER POSS COCAINE<br>-COURT ORDER POSS DRUG PARA<br><div id="mapContainer"></div><script type="text/javascript" > var map = new YMap(document.getElementById('mapContainer'));map.addPanControl(); map.addZoomLong();map.drawZoomAndCenter(" 111 NW 14TH CT,FORT LAUDERDALE, FL,33311 ", 3);map.addOverlay(new YMarker(" 111 NW 14TH CT,FORT LAUDERDALE, FL,33311 ", 'id2'));</script>
--------------------
You'll notice that what I'm trying to do is have the detailed information about someone show up on a detail page along with their address plotted out on yahoo maps. There is a javascript to include to have the map show up.
DigitalSkyline
22 Jul 2007, 9:34 AM
Where is the code that's performing the load url? You'll need to specify scripts:true within that block.
When a script is loaded, it will be eval'd within an Ext function, so if you have a script such as :
function thisFn(){}
then in the html:
onclick="thisFn();"
You will get an error. because thisFn is not defined in the window namespace. You can first globally define thisFn, and it will work as disired.
DigitalSkyline
22 Jul 2007, 9:36 AM
<script type="text/javascript" src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=MUA4d6vV34GJHim6JciryOGm8il6u pqlGrkrmiwou_bHFN28xAPmxU_C2Z8-"
> </script>
This will not work, because its calling an external script. You might have to use an iframe in this case.
mfw24
22 Jul 2007, 3:51 PM
Here's the code performing the load...
openNewTab: function(id){
//Create new panel
var newCenterTabId = createCenterTab('Detail',id);
var url = "criminaloffense.aspx?id=" + id;
var newTab = Ext.get(newCenterTabId);
var updater = newTab.getUpdateManager({disableCaching:true, loadScripts: true});
updater.update(url);
}
mfw24
22 Jul 2007, 4:23 PM
If I have to, how do i create the new pannel with an iframe? (vs using div tags)
AddOn
12 Sep 2007, 11:58 PM
Hi mfw24,
did you ever get answer to your question? I have the same problem.
I'm trying to build a new application which is loading old application parts by clicking on center tabs.
When I turn loadScripts to true IE does nothing and FF jumps to a blank white page. Firebug's telling me, that the used scripts are not available.
When I copy the URL into a separate window, the site works :((
So, my question is, if I have to use iframes to keep the old code running and how can I create such iframes for contentTabs using extJS??? I found no example in the forum. :-?
DigitalSkyline
13 Sep 2007, 8:32 AM
you might try this ux: http://extjs.com/forum/showthread.php?t=12706
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.