Pass Arguments to Include Component

From Documentation
Revision as of 06:58, 24 December 2012 by Hawk (talk | contribs) (copy from "MVVM>Advance>Access Arguments")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


DocumentationZK Developer's ReferenceMVVMAdvancedPass Arguments to Include Component
Pass Arguments to Include Component


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

Last Update : 2012/12/24


Version Date Content
6.0.0 February 2012 The MVVM was introduced.




Last Update : 2012/12/24

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.