PDA

View Full Version : Ext.ComponentLoader always expecting JSON even when set to HTML



FoxMulder900
26 Aug 2011, 6:30 AM
I have the following code that is trying to load a plain html file into a panel:



infoPanel.add({
xtype: 'panel',
autoHeight: true,
frame: false,
loader: {
autoLoad: true,
renderer: 'html',
url: 'resources/txt/test.html',
}
});


This worked fine before 4.0.5 but now I am getting the error:
"Uncaught Ext.Error: You're trying to decode an invalid JSON String:"

The documentation here:
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.ComponentLoader-cfg-renderer
s (http://docs.sencha.com/ext-js/4-0/#!/api/Ext.ComponentLoader-cfg-renderer)ays that it should be able to load raw html.

Any ideas?

skirtle
29 Aug 2011, 2:48 AM
What do you mean by 2.0.5?

Which ExtJS version are you using?

Could you post the entire stacktrace for the error? I've taken a look at the Ext source code and I don't see an obvious reason why it would be treating your HTML as JSON.

BTW, you also have a stray comma at the end of your loader config.

FoxMulder900
29 Aug 2011, 5:57 AM
Oops, that was supposed to say 4.0.5!

Here is the full stack trace:

Uncaught Ext.Error: You're trying to decode an invalid JSON String: Sample text from html file

Ext.Error.Ext.extend.statics.raise ext-debug.js:8085
(anonymous function) ext-debug.js:8328
Ext.apply.success Main.js:101
Ext.apply.callback ext-debug.js:8539
Ext.define.onComplete Connection.js:742
Ext.define.onStateChange Connection.js:690
(anonymous function) ext-debug.js:2385

And thanks for pointing out the comma... apparently I stop seeing clearly on Friday afternoons :)

FoxMulder900
29 Aug 2011, 8:54 AM
Ok, this was my own mistake - one of my overrides was calling Ext.decode() .... thanks for the reply and sorry to bother you!