PDA

View Full Version : autoload with script true



luke8211
20 Oct 2010, 1:26 AM
Hello, how can i set in ext designer in tabPanel or Panel autoLoad: 'php_file.php' with script:true?
Default is script = false and when I need activate scripts and event handlig in ajax loaded file I have to change into *.ui.js file by hand:

FROM DESIGNER:

autoLoad: 'loaded_file.html'I NEED:

autoLoad: {
url: 'loaded_file.html',
scripts: true
}Thanks for reply

jarrednicholls
20 Oct 2010, 4:47 AM
I would ignore that option on the Panel, and simply perform a load after the panel has been rendered, which is equivalent of the autoLoad config:



MyPanel = Ext.extend(MyPanelUi, {
initComponent: function() {
MyPanel.superclass.initComponent.call(this);

this.on('render', this.doAutoLoad, this, {delay:10});
},

doAutoLoad: function() {
var u = this.body.getUpdater();
u.update({
url: 'loaded_file.html',
scripts: true
});
}
});

luke82
20 Oct 2010, 7:01 AM
Thanky you, that's work fine.

But I have next problem. I loaded html content into the tab with <a href... links. I would like to click on this link and dynamically create a new tab in tabpanel.

From class thats work fine after render... I used this:


initEvents: function() {
MainPanel.superclass.initEvents.call(this);
this.get('tabPanel').add({
title: 'New Tab ',
iconCls: 'tabs',
html: 'Tab Body',
closable:true
}).show();
}
but I need call event from a href link a create a tab. This not working



Ext.get('content_link').on('click', function() {
this.get('tabPanel').add({
title: 'New Tab ',
iconCls: 'tabs',
html: 'Tab Body',
closable:true
}).show();
}, scope);

dobberph
20 Oct 2010, 3:10 PM
Hi,

I have nearly the same problem:
Somewhere in the code I have this Panel, where Javascript is not excecuted.

{
columnWidth:1,
baseCls:'x-plain',
bodyStyle:'padding:10px 0 5px 5px;text-align:left;',
items:[
{
title: '',
autoload: {
url: '<?echo $_SESSION["page"];?>',
scripts: true
},
border: false
}
]
}Can you help me?

Best regards,
dobberph

jarrednicholls
21 Oct 2010, 6:52 AM
Hey dobberph,

It's "autoLoad" with a capital L, not autoload. Perhaps that's the issue?

dobberph
21 Oct 2010, 8:23 AM
Unfortunately not :s

The scripts on the autoLoad-page are not excecuted...
I get it work with an iframe but thats not what I want.
I can't use an iframe for some contruction-cirumstances.

Hope someone can help.

dobberph
28 Oct 2010, 1:30 AM
Haha,

the bug was the header of the page.
It was
header('Content-Type: text/css');

But of course it should be:

header('Content-Type: text/javascript');

Best regards,
dobberph