0

Mixing html with ZK components

asked 2011-09-26 20:39:44 +0800

vsony7 gravatar image vsony7
102 1

updated 2011-09-26 21:16:10 +0800

Hi,

Is there a way I can mix html and zk components? When I try doing that, the html text does not flex and is cut off from the window. I am sure that there are ways to rewrite the entire html using zk components but for sake of simplicity is there a way I can stick to html and enable resizing/flexing to work as expected?

The html paragraph is cut off in the below example. You can test this here

Please see the code below:

<zk xmlns:html="http://www.w3.org/1999/xhtml">
<vlayout hflex="1">
<hlayout hflex="1">
  <button id="help">Help</button>
  <html:div>
   <html:p>
  	We will use the email address you provide to send you password
    reminders, requests for ownership changes, and we may send you
	announcements about the application.  We will not share your email address
	with anyone.  We do not verify that you own the email address
    you provide.
    </html:p>
    <html:ol>
    <html:li>abc</html:li>
    <html:li>abc</html:li>
    <html:li>abc</html:li>
    </html:ol>
    <html:a href="http://google.com">Google</html:a>
  </html:div>
</hlayout>
</vlayout>
</zk>

I am not sure if this is a bug. I am wondering if it is more appropriate to post it as a feature request?

Another example is here
Again, the html text is cut off when the parent component is hlayout. See code below:

<zk>
   <hlayout hflex="1">
    <html><![CDATA[
        Sample <b><font color="#008BB6">Shopping Cart</font></b> Table in Plain HTML
        <ul> 
        <li>Productivity</li> 
        <li>Security</li>
        <li>Performance</li>
        <li>Totally Control</li>
        <li>Auto Testing</li>
        <li>Scalability</li>
        <li>Flexibility</li>
    </ul> 
    <p>
  	We will use the email address you provide to send you password
    reminders, requests for ownership changes, and we may send you
	announcements about the application.  We will not share your email address
	with anyone.  We do not verify that you own the email address
    you provide.
    </p>
    ]]></html>
    </hlayout>
</zk>

Thanks,
Sony

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2011-09-26 21:51:05 +0800

RichardL gravatar image RichardL
768 4

Hi Sony,
Pop this in the container's (Hlayout) style attribute and you're good to go: white-space:pre-line;

link publish delete flag offensive edit

answered 2011-09-26 22:01:43 +0800

vsony7 gravatar image vsony7
102 1

Hi Richard,

Thanks for the quick fix. But adding the style attribute creates a lot of extra space between components. Is there a way to maintain a more compact layout design?

See: http://top.cs.vt.edu:8080/editionbuilder/src/zul/testhtml3.zul (The text is not cut off but lot of extra space)

See: http://top.cs.vt.edu:8080/editionbuilder/src/zul/testhtml2.zul (The text is cut off but the layout is more compact)

Is there a way to achieve both text resizing and compact layout?

Thanks,
Sony

link publish delete flag offensive edit

answered 2011-09-26 22:27:19 +0800

RichardL gravatar image RichardL
768 4

The links you provided are to localhost so I can't see them, but I looked at the code in Sandbox. The space you mention is not between components, it's between DOM elements. You can fix this up through CSS. Cheers, Richard

link publish delete flag offensive edit

answered 2011-09-27 05:58:03 +0800

dagarwal82 gravatar image dagarwal82
246 4

You might want to try adjusting the line-height, style="line-height:16px"

link publish delete flag offensive edit

answered 2011-09-27 14:38:25 +0800

vsony7 gravatar image vsony7
102 1

@Rcihard and dagarwal: Thanks!

link publish delete flag offensive edit

answered 2011-10-04 00:06:07 +0800

tomyeh gravatar image tomyeh
610 1 3
http://blog.zkoss.org ZK Team

updated 2011-10-04 00:09:10 +0800

It is a bug. Please follow it at ZK-477.

Workaround:
Add style="white-space: normal" to html:div

<hlayout ...
  <button ...
  <html:div style="white-space:normal">

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: 2011-09-26 20:39:44 +0800

Seen: 1,439 times

Last updated: Oct 04 '11

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