PDA

View Full Version : can't access Ext from a loaded html inside a Tab



BlancoX
22 Nov 2009, 12:20 PM
Hi all,

Im quite newbie, although been following extjs since release1. Hope to post accordly to this forum rules.

First: screenshot
http://img156.imageshack.us/img156/2506/problemscreenshot.jpg


In my west panel i got links to some database tables. When clicked, they open new tab for each table in the "center" region. Its content is loaded via autoload {url: ....}.

The code for loading works fine, and the html requested is shown in firebug, including the javascript of that contents loaded.

function loadPage(href,...)
{
...
var autoLoad = {url: '/async/load/'+href};
var p = contenido.add(new Ext.Panel({
closable: true,
autoScroll:true,
title: title,
id: id,
autoLoad: autoLoad,
iconCls: iconCls
}));
contenido.setActiveTab(p);
}



Now, the problem:
The javascript loaded can't access Ext, so i can't create nor run extjs components in that loaded content. Firebug message:


Ext is not defined
[Break on this error] var store = new Ext.data.ArrayStore({\n

example of some code inside the loaded html content:


// create the data store
var store = new Ext.data.ArrayStore({
fields: [
{name: 'company'},
{name: 'price', type: 'float'},
{name: 'change', type: 'float'},
{name: 'pctChange', type: 'float'},
{name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
]
});


Finally, my question(s)
1.- How can i access Ext from the javascript inside that content loaded so to be able to code scripts separately and load and run them just on user's request?
2.- Is there anyway to "register" the new code loaded (components) into the global Ext application?

Im really stuck... Thanks in advance for any help or advice
Jose Maria

BlancoX
22 Nov 2009, 12:54 PM
holy crist... solution was as simple as:



var autoLoad = {url: '/async/load/'+href, scripts: true };


DAMMITTTTTTTTTTTTT! 2 hours crawling internet to find this...

Thanks anyway.