PDA

View Full Version : [CLOSED] TabPanel and Iframe



CanopiusApplications
Aug 28, 2017, 10:38 AM
Hi

I have a Tab with a panel such as




<ext:Panel ID="Panel1" runat="server" Header="false" BodyPadding="3" Flex="1" Border="false" Hidden="false">
<Loader runat="server" Url="" Mode="Frame" AutoLoad="false">
<%--<LoadMask ShowMask="true" /> --%>
</Loader>
</ext:Panel>



I then set the URL to something heavy like a PDF (in this case adobe pdf viewer plugin loads in browser). I have also seen this same problem when setting the URL to a local UNC address.

The problem is that when I switch back to a previous tab the PDF is still visible, if I close the window containing the tabs then again the PDF is still visible however if I were to close the window while tab containing the PDF was still active then the PDF is no longer overlayed (window is simply hidden).

Chrome no problem but IE (10) not so

CanopiusApplications
Aug 28, 2017, 12:49 PM
You can close this and worked around it by not using a loader / iframe and writing the into an object tag.
For those who come across this problem here is what I did.




<ext:Panel ID="pnlDoc" runat="server" Header="false" BodyPadding="3" Flex="1" Border="false" Hidden="true" >
<Content>
<div id="container"><div>
</Content>
</ext:Panel>

App.direct.ctlDocViewer.LoadForm(record.data.DocNu m, {
success: function (result) {
if (filetype == 1) {
var url = 'Handlers/Docs.ashx?docid=' + record.data.DocNum + "&type=1";

// Old -- set the iframe
//App.ctlDocViewer_ctlDocDisp_pnlDoc.getLoader().loa d({ url: url })

// New set the object
document.getElementById("ctlDocViewer_ctlDocDisp_pnlDoc-innerCt").innerHTML = '<div id="container" style="height:100%; width:100%"><object type="application/pdf" data=' + url + ' style="height:100%; width:100%"></object><div>';

}
Ext.net.Mask.hide();

}

});



Seems to work ok on IE10 and Chrome with the Adobe pdf plugin.

fabricio.murta
Aug 28, 2017, 9:38 PM
Hello @CanopiusApplications!

This is really a difficult aspect to handle as we can't guarantee if people will have the adobe flash plugin on their browsers and if the browser will be using an adobe plug in (which can be from 3rd parties) that behaves the way we expect.

Maybe the best way with that if your solution (thanks for providing us with what worked for you!) would using a JavaScript library to ensure the PDF output will be handled the same way across browsers. If you're curious on that, give the forums a search, there's a thread here covering roughly the usage of a javascript library to encapsulate this content to the page and have a proper handling. We can't really provide further support over third-party javascript libraries though, so it is left just as a suggestion on ways to go. And by now there may be better libraries available over there.

If you are curious on the subject and can't find the thread, let us know.

CanopiusApplications
Aug 29, 2017, 8:59 AM
Hi Fabricio

Yeah I appreciate the difficulties with the various 3rd party plugins knocking about. For the sake of this thread though the browser version / plugin is not a problem as I control all of that (internal app) so in this case the c# handler and writing the stream directly into the object tags fits best although for extranet/internet I would probably do it slightly differently.

I played with a few other options.

1. PDF.js -- World of pain here but works (sort of). My main problems here were that it only opened 7/10 of our MFD produced PDF's and biggest of all it was much slower than the Adobe OCX. I would certainly revisit this for deployments to the wild.

2. DevExpress -- did not really like the idea of conversion to image and displaying that.

Thanks for responding,
D