PDA

View Full Version : Pass a Parameter to Layout/Tabs



sjm133
7 Apr 2011, 4:45 AM
I'm using Ext 3.3.1 and working from the example window/layout.html.

My page will be rendered by script; HTML and javascript. My html will have anywhere from 1 to [n] items listed. My goal is to have a link or button next to each item. When that item is clicked the window layout will open containing two tabs each with an "autoload" that calls a script to load the tab content. So I need to pass a parameter to the window so that I can then pass it to the script that renders the content to show the detail information. Does anyone have any suggestions on how to to this?

Thanks in advance.

Screamy
8 Apr 2011, 9:14 AM
Would something like this work for you?



Ext.ns('myApp.global');

myApp.global.tabbedWindow = function(config) {
var window = new Ext.Window({
height: 400,
layout: 'fit',
title: 'Tab Window',
width: 400,
items: [{
xtype: 'tabpanel',
activeTab: 0,
items: [{
xtype: 'panel',
autoLoad: {
url: config.tab1Url
},
title: 'Tab 1'
},{
xtype: 'panel',
autoLoad: {
url: config.tab2Url
},
title: 'Tab 1'
}]
}]
});

return window;
};


var config = {
tab1Url: 'data/getSomething.action',
tab2Url: 'data/getSomething2.action'
};

var windowInstance = myApp.global.tabbedWindow(config);
windowInstance.show();