0

Template composition: include and template

asked 2012-09-06 07:43:14 +0800

gsim gravatar image gsim
81

Hi,

I'm facing some problems with templating composition when I include the template zul as the main component in a hierarchy.

I've made a fiddle to show this problem. You can see the intended design (pressing "To Template" button) and the rendered result when including the template (pressing "To Included Template").

Do you think this is a bug in zk or did I miss something?

ZKFiddle-Link

include.zul
<zk>
<include src="main.zul" />
</zk>

main.zul
<?init class="org.zkoss.zk.ui.util.Composition" arg0="template.zul" ?>
<zk>
<include self="@{define(left)}" src="left.zul" />
<include self="@{define(right)}" src="right.zul" />
</zk>

template.zul
<zk>
<borderlayout>
<center self="@{insert(left)}" style="background: #863" />
<east width="50%" self="@{insert(right)}" style="background: #368" />
</borderlayout>
</zk>

right.zul
<zk>
<box width="100%" height="100%" pack="center" align="center">
<label value="RIGHT" />
<button onClick='Executions.sendRedirect("index.zul")' label="Back" />
</box>
</zk>

left.zul
<zk>
<box width="100%" height="100%" pack="center" align="center">
<label value="LEFT" />
<button onClick='Executions.sendRedirect("index.zul")' label="Back" />
</box>
</zk>

index.zul
<zk>
<button onClick='Executions.sendRedirect("main.zul")' label="To template" />
<button onClick='Executions.sendRedirect("include.zul")' label="To included template" />
</zk>

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2012-09-06 10:23:20 +0800

gsim gravatar image gsim
81

updated 2012-09-06 10:24:10 +0800

If I replace

<include src="main.zul" ></include>

with

<include src="main.zul" mode="defer" ></include>

the layout is created fine, but I have the disadventages of the the defer mode.

Is there any way to use an instant include and make the composition work?

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: 2012-09-06 07:43:14 +0800

Seen: 115 times

Last updated: Sep 06 '12

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