@BindingParam"

From Documentation
(Created page with "{{ZKDevelopersReferencePageHeader}} =Syntax= <source lang="java"> @BindingParam("keyString") </source> = Description = '''Target:''' Command method's parameter '''Purpose:'...")
 
m ((via JWB))
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{ZKDevelopersReferencePageHeader}}
 
{{ZKDevelopersReferencePageHeader}}
 +
{{Deprecated | url=[http://books.zkoss.org/zk-mvvm-book/8.0/syntax/bindingparam.html zk-mvvm-book/8.0/syntax/viewmodel/parameters/bindingparam]|}}
  
  
Line 18: Line 19:
  
 
'''Command binding that pass parameters'''
 
'''Command binding that pass parameters'''
<source lang="xml" high="8">
+
<source lang="xml" highlight="8">
  
 
<listbox model="@load(vm.items)" selectedItem="@bind(vm.selected)" hflex="true" height="300px">
 
<listbox model="@load(vm.items)" selectedItem="@bind(vm.selected)" hflex="true" height="300px">
Line 45: Line 46:
  
 
</source>
 
</source>
* The <tt>target </tt>'s value is "myValue", and <tt> content</tt>'s is object item's description property.
+
* The <code>target</code>'s value is "myValue", and <code>content</code>'s is object item's description property.
 +
 
 +
 
 +
 
 +
 
 +
=Version History=
 +
 
 +
{| class='wikitable' | width="100%"
 +
! Version !! Date !! Content
 +
|-
 +
| 6.0.0
 +
| February 2012
 +
| The MVVM was introduced.
 +
|}
 +
 
  
  
 
{{ZKDevelopersReferencePageFooter}}
 
{{ZKDevelopersReferencePageFooter}}

Latest revision as of 07:36, 8 July 2022

Stop.png This article is out of date, please refer to zk-mvvm-book/8.0/syntax/viewmodel/parameters/bindingparam for more up to date information.


Syntax

@BindingParam("keyString")

Description

Target: Command method's parameter

Purpose: Tell binder to retrieve this parameter with specified key from binding argument on the ZUL.

The annotation is applied to command method's parameter. It declares the applied parameter should come from binding argument written on the ZUL with specified key.

Example

Command binding that pass parameters

		<listbox model="@load(vm.items)" selectedItem="@bind(vm.selected)" hflex="true" height="300px">
			<listhead>
				<listheader label="Name"/>
				<listheader label="Price" align="center" />
				<listheader label="Quantity" align="center"  />
			</listhead>
			<template name="model" var="item">
				<listitem onMouseOver="@command('popupMessage', myKey='myValue', content=item.description)">
					<listcell label="@bind(item.name)"/>
					<listcell label="@bind(item.price)"/>
					<listcell label="@bind(item.quantity)"/>
				</listitem>
			</template>
		</listbox>

Command method in ViewModel with binding parameter

	@Command
	public void popupMessage(@BindingParam("myKey")String target, @BindingParam("content")String content){
		//...
	}
  • The target's value is "myValue", and content's is object item's description property.



Version History

Version Date Content
6.0.0 February 2012 The MVVM was introduced.




Last Update : 2022/07/08

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