PDA

View Full Version : remote urls in contentPanel tab problem



scoobasteve1982
27 Jul 2007, 9:56 AM
Hi there. Okay so it took me about 8 hours to finally get my code working to dynamically generate tabs in a center content panel (and it shouldnt have taken that long btw lol). However, I can only seem to load a local file and not a remote url (i.e. Google or some other page). Below is the code that I'm using to create the dynamic tab.



...

openTab: function(config)
{
var newPanel;

//create div by hand instead of using autoCreate
Ext.DomHelper.append('center-div', {
tag:'div',
cls: 'dynamicTab',
id:config.id
});
newPanel = new Ext.ContentPanel(config.id, {
title: 'Tab Title',
closable: true,
autoScroll: true,
fitToFrame:true,
//url:'http://www.google.com'
});

newPanel.load({
url:'http://www.google.com',
params: config.params,
discardUrl: true,
nocache: true,
text: "Tester",
timeout: 30,
closeable: true,
scripts: true
});
mainLayout.getRegion('center').add(newPanel);

} //end openTab



Any thoughts? If this isn't enough code please let me know and I'll post more. Also, the little X so that I can close the tabs aren't displayed. Any ideas? I was considering maybe putting an iframe in the tab so that remote URL could be loaded in the panel. :-/:-/ Thanks for any help you can provide.

scoobasteve1982
27 Jul 2007, 11:05 AM
Okay so I've managed to figure out how to auto resize tabs and have them at the top of my panel however I'm still stumpted on the remote URL displaying. All I get when I attempt to do this is an ajaxian load icon and the text "Loading...". Any help would be greatly appreciated. Thank you for your time.

tryanDLS
27 Jul 2007, 11:13 AM
You can't load from another URL that way - it's a violation of XmlHttpRequest security. You could put an iframe in the panel and set it's src to google.com. See the Layout tutorial for some discussion.

scoobasteve1982
27 Jul 2007, 11:23 AM
Oh okay I didn't realize that it was using the XmlHttpRequest object. Thank you for the clarification. However, I do know how to add iframe to content panels from the examples I've seen, however these are being added dynamically. Any hints or URLs to resources on here that might help? Again, thanks for your time. I appreciate your patience.

scoobasteve1982
27 Jul 2007, 12:06 PM
I found the solution however..... This may not be the correct way, and if their is a better way please let me know. What I did was call a local PHP file and supplied a few parameters to it (via $_GET). Then I created an iframe with a width and height of 100% and load the src with the URL get parameter. I also provide a unique ID as well if I need to access the iframe later. Seems to work. However, in IE it broke EVERYTHING but in Firefox and Safari it works great. Hmmm...