PDA

View Full Version : How can I change config option html: after creating panel?



unixmast
22 Nov 2007, 7:13 PM
Dear ext users;

I wanna change config option html:'s content after creating panel.


I hope display the appropriate pdf file in panel when user select a row in a grid panel.
A initial pdf file which is hard coded before creating panel is displayed well, but how can I change the pdf file name to be display ?

I use html: config option to display initial pdf file, is this correct method ?

Any idea and/or advice will be welcome.
Thanks.

efege
22 Nov 2007, 7:43 PM
What value are you passing to the html config option? Are you using an iframe to display the pdf file?

unixmast
22 Nov 2007, 10:08 PM
'<OBJECT CLASSID="clsid:CA*A9780-280D-11CF-A24D-444553540000" WIDTH="100%" HEIGHT="100%"><PARAM NAME
="SRC" VALUE="MLBOOK.pdf"><EMBED src="MLBOOK.pdf" width="100%" height="100%"><NOEMBED> Your browser does not suppor
t embedded PDF files. </NOEMBED></EMBED> </OBJECT>'

efege
23 Nov 2007, 4:04 AM
I tested this code with success:



pdf1 = 'mypdf1.pdf';
pdf2 = 'mypdf2.pdf';

function buildHtml(pdf) {
var html = '<OBJECT CLASSID="clsid:CA*A9780-280D-11CF-A24D-444553540000" WIDTH="100%" HEIGHT="100%"><PARAM NAME="SRC" VALUE="' + pdf + '"><EMBED src="' + pdf + '" width="100%" height="100%"><NOEMBED> Your browser does not support embedded PDF files. </NOEMBED></EMBED> </OBJECT>';
return html;
}

panel = new Ext.Panel({
width: 500,
height: 300,
title: 'PDF viewer',
html: buildHtml(pdf1),
buttons: [{
text: 'Change PDF',
handler: function(btn) {
panel.body.update(buildHtml(pdf2));
btn.disable();
}
}]
});
panel.render(document.body);

unixmast
23 Nov 2007, 11:55 AM
Too much tanks for your kind reply.
Your nice sample clears everything.
Thanks again.
:D

mxu
23 Nov 2007, 12:04 PM
how to dynamically assign CLASSID/clsid:
CLASSID="clsid:CA*A9780-280D-11CF-A24D-444553540000"

efege
23 Nov 2007, 12:10 PM
I just blindly replaced the file name (MLBOOK.pdf) in unixmast's string, by a variable. But I have no idea about CLASSID, what it means, and where it comes from :-/

So I'm not even sure if I understand your question, mxu.

hendricd
23 Nov 2007, 12:24 PM
An assumption is made, that the Acrobat viewer will be installed on the client. That uuid is a known classid for Acrobat's embedded Browser Viewer Object.

mxu
24 Nov 2007, 11:07 AM
that means I have to know classid for pdf app first at client side before I can use
object tag, right ?

if so, how can I get classid ? using file association on web browser ? and how to ?

thanks

hendricd
24 Nov 2007, 11:23 AM
It's not dynamically assigned at runtime, its a published (by Adobe) clsid. Does the one he posted earlier work for you?

But there are changes (http://www.adobe.com/devnet/activecontent/articles/devletter.html) in the wind.