PDA

View Full Version : Hmmm... How do I load a layouts panel with a PHP page?



cluettr
24 Apr 2007, 2:42 PM
OK, I did my homework and I'm starting to get my head around javascript objects, methods and properties. I understand most of the layout examples but I'm not quite sure how to load one of the ContentPanels with a URL. I'd be ever so appreciative if someone could clue me in. I hate pasting code because often time it serves no purpose but here is the code I am trying to work with. I'd like to load the contents of a URL into say the center panel.

<script type="text/javascript">
Example = function(){
var layout;
return {
init : function(){
layout = new Ext.BorderLayout(document.body, {
west: {
split:true,
initialSize: 200,
minSize: 175,
maxSize: 400,
titlebar: true,
collapsible: true,
animate: true,
collapsed: true
},
east: {
split:true,
initialSize: 202,
minSize: 175,
maxSize: 400,
titlebar: true,
collapsible: true,
animate: true,
autoHide: true,
collapsed: true
},
south: {
split:true,
initialSize: 200,
minSize: 100,
maxSize: 200,
titlebar: true,
collapsible: true,
animate: true
},
center: {
titlebar: false,
autoScroll:true,
closeOnTab: true
}
});

layout.beginUpdate();
layout.add('south', new Ext.ContentPanel('south', {title: 'RMA Details', closable: false}));
layout.add('west', new Ext.ContentPanel('west', {title: 'West'}));
layout.add('east', new Ext.ContentPanel(Ext.id(), {autoCreate:true, title: 'History', closable: false}));
layout.add('east', new Ext.ContentPanel(Ext.id(), {autoCreate:true, title: 'History2', closable: false}));
layout.add('east', new Ext.ContentPanel('autoTabs', {title: 'Notes', closable: false}));
layout.add('center', new Ext.ContentPanel('center1', {title: 'RMA\'s', 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';
}
}
};

}();
Ext.EventManager.onDocumentReady(Example.init, Example, true);

</script>

jsakalos
24 Apr 2007, 3:39 PM
Look for ContentPanel.setUrl method in documentation.

After you set url with this method the content of the panel is loaded whenever you activate it. You can see this best if you have more than one tab in a panel.

Hope it helps

sonic64
25 Apr 2007, 12:16 AM
You may simply use iframe to show the content of a page in your layout

mschering
8 May 2007, 12:37 PM
How do you activate a panel?

I'm trying to dynamically change the URL and title when a link is clicked. Simply doing setUrl and setTitle does not update the content nor does it give an error in firebug.

fay
8 May 2007, 12:45 PM
Try calling refresh() after setUrl(), or alternatively load()

From the docs:


refresh() : void ContentPanel
Force a content refresh from the URL specified in the setUrl() method. Will fail silently if the setUrl method has not been called. This does not activate the panel, just updates its content.