View Full Version : Problem with Panel autoLoad

25 Nov 2010, 2:48 AM
I've run into a problem which should be easy. I'm trying to use the autoLoad config option in a panel to load a HTML page so that it displays in that panel. The code that Iv'e got to load this is:

header_panel = new Ext.Panel ({
height: 100,
region: "north",
autoLoad: {
url: "admin/content/header",
scripts: false
This gives me an error in firebug of "missing ) in parenthetical". From what I can see, this happens because the load function is trying to pass the HTML content through an eval () function call thinking that it's getting JSON back:

[Break on this error] <!DOCTYPE html PUBLIC "-//W3C//DTD XHT...org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n
ext-all-debug.js (line 12435)

Am I right in thinking that autoLoad should load a standard HTML page into the panel? That's what the docs say, so that's what I've assumed...

25 Nov 2010, 6:55 AM
1. Your code example is missing a } (try jslint.com).
2. autoLoad can't load full HTML pages. It can only load HTML fragments (no HTML, HEAD, LINK or BODY tags).
3. If you want to load full HTML pages you should be using IFRAMEs.

25 Nov 2010, 2:42 PM
I had a feeling that I should only be loading fragments... Strange that sort of info isn't in the docs, but at least I know now.


25 Nov 2010, 2:51 PM
Would you write a page like this?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHT...org/TR/xhtml1/DTD/xhtml1-strict.dtd">

25 Nov 2010, 3:15 PM
Yeah, I do get that now.

But, would eveyrone in the world expect to get content from a standard URL that doesn't have the head, etc in it?

That is how normal HTML pages are written, and as there's no indication in the docs that mention that it's loading only HTML snippets, and not an actual page, it is pretty ambiguous. I understand why it does it that way, just saying that a little more info in the docs to actually mention things like this is never a bad thing, especially when it can help stop silly questions like mine from coming up. :)