Pass Arguments to Include Component
From Documentation
When you load a ZUL page using Executions.createComponents("mypage.zul", args) or <include> and pass arguments. ZK bind annotation EL expression can not reference those arguments directly. The simplest solution is to add an custom attribute to hold arguments for later reference. Let's see an example.
outer.zul
<include id="inc" type="typeValue" src="inner.zul"/>
- Here we pass an argument named "type" to an included ZUL.
inner.zul
<custom-attributes type="${arg.type}"/>
<vbox apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('foo.ExecutionParamVM')">
<button id="cmd1" label="cmd1" onClick="@command('cmd1', mytype=type)" />
</vbox>
- We should use a custom attribute (line 1) to hold the argument for later use (line 5).
Version History
Version | Date | Content |
---|---|---|
6.0.0 | February 2012 | The MVVM was introduced. |