Code:
<script type="text/javascript">
Example = function(){
var layout;
return {
init : function(){
layout = new YAHOO.ext.BorderLayout(document.body, {
hideOnLayout: true,
north: {
split:false,
initialSize: 25,
titlebar: false
},
west: {
split:true,
initialSize: 200,
minSize: 175,
maxSize: 400,
titlebar: true,
collapsible: true,
animate: true
},
east: {
split:true,
initialSize: 202,
minSize: 175,
maxSize: 400,
titlebar: true,
collapsible: true,
animate: true
},
south: {
split:true,
initialSize: 100,
minSize: 100,
maxSize: 200,
titlebar: true,
collapsible: true,
animate: true
},
center: {
titlebar: true,
autoScroll:true
}
});
var propsGrid = new YAHOO.ext.grid.PropsGrid('props-panel');
// bogus object as a data source
propsGrid.setSource({
"(name)": "Properties Grid",
"grouping": false,
"autoFitColumns": true,
"productionQuality": false,
"created": new Date(Date.parse('10/15/2006')),
"tested": false,
"version": .01,
"borderWidth": 1
});
propsGrid.render();
layout.beginUpdate();
layout.add('north', new YAHOO.ext.ContentPanel('north', 'North'));
layout.add('south', new YAHOO.ext.ContentPanel('south', {title: 'South', closable: false}));
layout.add('west', new YAHOO.ext.ContentPanel('west', {title: 'West'}));
layout.add('east', new YAHOO.ext.ContentPanel('autoTabs', {title: 'Auto Tabs', closable: false}));
layout.add('east', new YAHOO.ext.GridPanel(propsGrid, {title: 'Properties', closable: true}));
layout.add('center', new YAHOO.ext.ContentPanel('center1', {title: 'Overview', closable: false}));
layout.add('center', new YAHOO.ext.ContentPanel('center2', {title: 'Army', closable: false}));
layout.add('center', new YAHOO.ext.ContentPanel('center3', {title: 'Navy', closable: false}));
layout.add('center', new YAHOO.ext.ContentPanel('center4', {title: 'Air Force', closable: false}));
layout.getRegion('center').showPanel('center1');
layout.endUpdate();
},
toggleWest : function(link){
var west = layout.getRegion('west');
if(west.isVisible()){
west.hide();
link.innerHTML = 'Show West Region';
}else{
west.show();
link.innerHTML = 'Hide West Region';
}
},
trainTroops : function(link){
layout.getRegion('west').showPanel('west1');
}
}
}();
YAHOO.ext.EventManager.onDocumentReady(Example.init, Example, true);
I keep getting the error that "trainTroops" is not a defined function in Firebug.