PDA

View Full Version : load multiple tabs in one click



kresnandya
30 Nov 2007, 9:15 AM
Hi

my question is : is it possible to load multiple tabs in just one click ?

this is my code :

in sample.js

desktop.mj = Ext.extend(Ext.app.Module, {
id : 'mj-win',
init : function() {
this.launcher = {
text : 'test',
iconCls : 'icon-grid',
handler : this.createWindow,
scope : this
}
},
createWindow : window.createMj
});

window constructor

function createMj() {
var desktop = this.app.getDesktop();
var win = desktop.getWindow('mj-win');

// create tree
tree = new Ext.tree.TreePanel( {
animate : true,
enableDD : true,
containerScroll : true,
region : 'west',
margins : '3 0 3 3',
cmargins : '3 3 3 3'
});

root = new Ext.tree.TreeNode({text : 'Semua', allowDrag : false, allowDrop : false});
root.addListener("click", testLoad, this);
tree.setRootNode(root);

// create tab panel
pan = new Ext.TabPanel( {
defaults:{autoScroll:true},
region : 'center',
activeTab : 0,
items : [{
title: 'tab 1',
items: mainPanel = new Ext.Panel({
autoScroll : true,
margins : '3 3 3 0'
})
},{
title: 'tab 2',
items: detPanel = new Ext.Panel({
autoScroll : true,
margins : '3 3 3 0',
})
}]
})

if (!win) {
win = desktop.createWindow( {
id : 'mj-win',
width : 860,
height : 500,
layout : 'border',
items : [tree, pan]
});
}
win.show();
}

function for load panel

function testLoad() {
mainPanel.load({url : 'pages/mnj/Project.htm'});
detPanel.load({url : 'pages/mnj/Detail.htm'});
}

and the result is error : this.body has no properties

i also try to use listeners in second tab : listeners: {activate: loadDetail}:

functions for listeners :

function loadDetail() {
detPanel.load({url : 'pages/mnj/detail.htm'});
}

and the result is error : detPanel has no properties

im confused... please help me thx

tryanDLS
30 Nov 2007, 9:51 AM
Please post your code in CODE tags so others can read it. It sounds like you have a scope issue. Have you stepped thru your code with Firebug?

kresnandya
30 Nov 2007, 9:59 AM
yes, I've try to use firebug and change ext-all.js with ext-all-debug.js and gave an error in this line (maybe) : var um = this.body.getUpdater();

what is this mean ?

fermo111
6 Dec 2007, 2:25 AM
Same error here when I use the load() method of a panel

devnull
6 Dec 2007, 8:42 AM
looking at the above code, it is unclear where 'testLoad' is running from, leading me to believe that there are scoping issues.
fermo, post some code, we cant read your mind.

hendricd
6 Dec 2007, 9:19 AM
I hope all of this is wrapped in an Ext.onReady block ?