PDA

View Full Version : How to display external HTML files in a panel?



subashk
25 Jul 2011, 8:32 AM
We have some news content that gets copied to our app dir, and have to show them inside a panel by referencing a news.html file.

How to display external HTML files in a panel?

subashk
25 Jul 2011, 8:57 AM
the source file is a html file with frames...


<HTML>
<HEAD>
<TITLE>My Frameset Home Page</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX">
</HEAD>
<FRAMESET cols="200,*" FRAMEBORDER="0" BORDER="0" >
<FRAME SRC="mniLeft.html" NORESIZE scrolling=no>
<FRAME SRC="mniRightDefault.html" NAME="main" NORESIZE>
<NOFRAME>
<BODY>
You need a browser that can display frames to see this page. </BODY>
</NOFRAME>
</FRAMESET>
</HTML>

jjerome
25 Jul 2011, 9:09 AM
You can try an Ajax request with the url being the source path and have the Panel set up its html config as the request's response.



var source = 'path to html file here';

Ext.Ajax.request({
url : source ,
method: 'GET',
success: function ( result, request ) {
html = result.responseText;
var panel = new Ext.Panel({
html: html,
layout: 'fit'
});
},
failure: function ( result, request) {
Ext.Msg.alert('Failed');
}
});



I'm not sure if that would work. I have only used that with URL's not file paths.

Good luck