Hybrid View
-
29 Nov 2007 4:07 AM #1
Loading jsp content in the Panel
Loading jsp content in the Panel
Hello Guys,
I'm very new to Ext.
I have been trying something for the past 2/3 days and doesn't seem to be working out.
This is what im trying to achieve:
Create a Viewport using border layout.
Then load the contents of a jsp page in the center panel. But things doesn't work well.
Following is the code
Create a Viewport using border layout
now to content.jspCode:function buildPage() { var viewport = new Ext.Viewport({ title: 'Main App', layout: 'border', items: [{ title: 'Main Content', region: 'center', margins: '5 5 0 0', width: 400, autoLoad: {url: 'content.jsp'} }]}); } Ext.onReady(buildPage);
now content.jsHTML Code:<head> <script src="/js/extjs/adapter/ext/ext-base.js"></script> <script src="/js/extjs/ext-all.js"></script> <script src="/js/content.js"></script> <link rel="stylesheet" type="text/css" href="/resources/css/ext-all.css"> </head>
Basically im trying to load the contents of content.jsp in the center panel...Code:buildContent= function(){ return [ new Ext.Panel({ title: 'Panel 1', collapsible:true, renderTo: document.body, width:200, }) ]; } Ext.onReady(buildContent);
This doesn't seem to work...
Am I missing something here...
Any help would be appreciated..
Thanks in Advance..
Prabhu
-
29 Nov 2007 4:15 AM #2
Maybe you typed it incorrectly.
It is autoLoad not autoload
-
29 Nov 2007 5:20 AM #3
-
29 Nov 2007 5:47 AM #4
Here is a code to display the contents of a jsp file in a panel.
The scritps tag is used in order to enable scripts in the included pagePHP Code:function createCompanyMoreInfoWindow(chamberID, companyID){
//Display Panel Info about company
var panelInfo = new Ext.Panel({
frame: false,
border: false,
autoLoad: {
url: 'businessDetails.jsp',
params: 'chamber=' + chamberID + '&id=' + companyID,
scripts: true
}
});
//Display window
var win = new Ext.Window({
title: 'Περισσότερες Πληροφορίες',
closable: true,
plain: true,
modal: true,
width: 700,
height: 500,
iconCls: 'information',
layout: 'fit',
items: [panelInfo]
});
win.show();
};
-
29 Nov 2007 7:13 AM #5
ppolyzos:
Thanks a lot for the code.
But the problem is that when the jsp contains javascript to create the extjs components then it is not viewable. It works fine for html content within jsp.
In my case when i try to include content.jsp in the center panel it doesn't work.
But when i access the content.jsp directly through the url it works.
Any idea why this happens???
-
29 Nov 2007 8:02 AM #6
This has been covered many times. The content you return should be a html fragment, not a full document. You also don't need to reload the Ext code in the content you're loading. The content you're loading should not be in an onReady block - it's evaled and not executed til it's done.
Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide


Reply With Quote