PDA

View Full Version : Scripts dont work on tab content page



AlThar
20 Jan 2011, 2:20 AM
Good day.
I got tabPanel on my page.
What i want to do is - load content to each tab from another page. For examplae i got tabMain.html page and tabPanel on it. In this tab there is a tab "data". I want this tab to load content from another page (let`s say data.html)

I got code on tabMain.html


Ext.onReady(function()
{
var tabs = new Ext.TabPanel({
region: 'center',
margins:'3 3 3 0',
activeTab: 0,
defaults:{autoScroll:true},
flex:1,
items:[{
title: 'Statistics',
autoLoad:{url:getURLForPage("statistics.html")},
listeners:{
activate : function(panel){
panel.getUpdater().refresh();
}}
},{
title: 'Data',
autoLoad:{url:getURLForPage("data.html")},
listeners:{
activate : function(panel){
panel.getUpdater().refresh();
loadDataPage();
}}
},{
title: 'Reports',
autoLoad:{url:getURLForPage("reports.html")},
listeners:{
activate : function(panel){
panel.getUpdater().refresh();
}}
}]
});

var nav = new Ext.Panel({
title: 'Navigation',
region: 'west',
split: true,
width: 200,
collapsible: true,
margins:'3 0 3 3',
cmargins:'3 3 3 3'
});
var bot = new Ext.Panel({
title: 'Info',
region: 'south',
split: true,
height:200,
collapsible: true,
margins:'3 0 3 3',
cmargins:'3 3 3 3'
});

var pan = new Ext.Panel({
title: 'Zingaya admin',
layout:'vbox',
layoutConfig: {
align : 'stretch',
pack : 'start'
},
closable:false,
height:window.innerHeight,
plain:true,
layout: 'border',
deferredRender:false,
activeTab:0,
items: [nav, tabs,bot]
});
pan.render('main_form');
});

On my data.html page i got Ext script too.


Ext.onReady(function() {
alert("data loaded");
};
and some static HTML content.

When i select the "data" tab i see my content, but dont see my alert... It seams like javascript just dont execute when page content is loaded...

I even tried to write simple function in data.html page and call it when my tab already downloaded content page, but is says that my function in not specified...

Please tell me, how can i make my content page`s scripts work on caller page.

20 Jan 2011, 5:01 AM
try setting scripts : true on your autoLoader configs.