0

Override ZK behavior on get/set properties

asked 2012-08-21 18:32:59 +0800

shumy gravatar image shumy
244 1

Is there any way to override the default behavior to get/set properties.
Example:

<window apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('zk.scala.test.ScalaTestVM')">
	<grid model="@load(vm.users)">
		<columns>
			<column label="Name"/>
		</columns>
		<template name="model" var="item">
			<row>
				<label value="@load(item.name)"/>
			</row>
		</template>
	</grid>
</window>

Instead of using the getUsers and getName, could I use other methods? like getProperty("name")
Also, is there any way to convert my custom collections to use in "grid model" and other components?

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2012-09-19 03:24:28 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

updated 2012-09-19 03:25:38 +0800

Hi shumy,
You can call the getProperty mathod with EL.

public String getProperty(String name) {
	return "text: "+name;
}

<label value='@load(vm.getProperty("test"))'></label>

For more detail, you can refer to .http://books.zkoss.org/wiki/ZK_Developer%27s_Reference/MVVM/Data_Binding/EL_Expression#Call_Methods

link publish delete flag offensive edit

answered 2012-09-19 10:11:24 +0800

shumy gravatar image shumy
244 1

Yes, but... can I use @save(...) and @bind(...) in the same way?
Using getProperty("name") and setProperty("name", value)

link publish delete flag offensive edit

answered 2012-10-01 02:12:33 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

No, you need to use a convertor.

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-08-21 18:32:59 +0800

Seen: 140 times

Last updated: Oct 01 '12

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