0

iframe does not pay heed of 'height' when expressed in %

asked 2008-10-27 15:46:28 +0800

cvarona gravatar image cvarona
554 1 6

Hi,

I have an initially unloaded iframe within a 100% height/width window within a 100% height page. I would like this iframe to expand so that it fills up all the available room; it does not matter much whether it does so upon loading the page or upon loading the content.

I've tried the following options:
-iframe height=width=100% (standalone)</li>
-iframe height=width=100% within a center flex=true region within a borderlayout within the aforementioned window

and some other not very sensible combinations thereof.

My efforts have proven rather fruitless. Has anybody succeeded in making iframes adquire the desired size without especifying height in px?

With kind regards

C. Varona

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2008-10-28 16:48:15 +0800

iantsai gravatar image iantsai
2755 1

Maybe you can post your code(a reduced one would be better),
and then we can try to resolve your problem.

link publish delete flag offensive edit

answered 2008-10-29 09:22:52 +0800

cvarona gravatar image cvarona
554 1 6

The following will do:

<?xml version='1.0' encoding='UTF-8' ?>
<?page style="height: 100%" ?>
<window id="ConfigReportsPF_GenericExportView_form" mode="embedded" border="normal" width="100%" height="100%" focus="false">
<box id="_box0" orient="vertical" align="center" focus="false" height="100%" width="100%">
<iframe id="iframe" focus="false" height="100%" autohide="false" width="100%" scrolling="auto" />
<button label="Select file">
<attribute name="onClick">{
Object media = Fileupload.get();
if (media != null)
iframe.setContent(media);
}</attribute>
</button>
</box>
</window>

I'm using zk 3.5.1 and firefox 2.0. I usually try to load pdfs, but it's the same with, say, .txt.

With kind regards

C. Varona

link publish delete flag offensive edit

answered 2008-10-29 10:09:14 +0800

cvarona gravatar image cvarona
554 1 6

Mmmm, it's seems it's the box that prevents the iframe from expanding to occupy 100% of the room available:

<?xml version='1.0' encoding='UTF-8' ?>
<?page style="height: 100%" ?>
<window id="ConfigReportsPF_GenericExportView_form" mode="embedded" border="normal" width="100%" height="100%" focus="false" contentStyle="overflow: auto">
<iframe id="iframe" focus="false" height="100%" autohide="false" width="100%" scrolling="auto" />
<button label="Select file">
<attribute name="onClick">{
Object media = Fileupload.get();
if (media != null)
iframe.setContent(media);
}</attribute>
</button>
</window>

This other box-less example works perfectly. However, any attempt to use box/vbox seems to interfere with the sizing mechanism of the iframe itself. Rather unfortunately, our generated zul forms often resort to boxes in order to group components.

With kind regards

C. Varona

link publish delete flag offensive edit

answered 2008-11-01 07:28:04 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

cvarona,

box is implemented with TABLE, TR, and TD tags whose width depends on its content. While iframe width=100% means determine its width based on the containing tag. So they are virtually "contradict to each other". I would suggest to use <div>, <borderlayout>, etc as your grouping components in such conditions.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2008-10-27 15:46:28 +0800

Seen: 587 times

Last updated: Nov 01 '08

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More