1

Difference Between @load,@save,@bind

asked 2015-04-02 06:28:45 +0800

RD190 gravatar image RD190
27 3

updated 2015-04-02 06:29:11 +0800

Can someone please explain me the difference between @load,@save,@bind with an example, i have read about them but i got more confused about the basic difference between them. they all look and work in somewhat same manner.

what does it mean when i write something like below

<textbox value="@load(vm.address.streatName)"/>
<datebox value="@save(vm.trip.leaveDate)"/>
<label value="@bind(vm.name)"/>

thanks in advance

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
3

answered 2015-04-02 06:38:19 +0800

echarish gravatar image echarish flag of Japan
1809 7
http://jp.linkedin.com/in...

updated 2015-04-02 07:17:39 +0800

Hello RD

they all are the annotations used for data binding by MVVM in ZK and they do exactly what their name suggest they do i.e.

@load(...): used to bind data and command along with parameters for loading data to target

@save(...): used to bind data and command along with parameters for saving data.

@bind(...): used to bind data along with parameters for both loading and saving.

@bind(...) is shortcut for "@load(...) @save(...)", and @save is automatically ignored if the property doesn't support it

<textbox value="@load(vm.address.streatName)"/>

This will load the value of your textbox from the property streatname of bean address

<datebox value="@save(vm.trip.leaveDate)"/>

this will save or update or modify the value of datebox to the property leaveDate of bean trip

<label value="@bind(vm.name)"/>

this will bind the value of label to property named name of vm and onChange or value the label value will also change.

They all will reflect the changes done to binding property if you choose to do so, while building your bean with the help of annotation like @NotifyChange etc.

I hope i was able to clear some doubts.

link publish delete flag offensive edit
0

answered 2015-04-02 10:47:24 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

+1 :-) good explanation.

link publish delete flag offensive edit

Comments

:) thanks.

echarish ( 2015-04-02 13:34:44 +0800 )edit
Your answer
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
1 follower

RSS

Stats

Asked: 2015-04-02 06:28:45 +0800

Seen: 230 times

Last updated: Apr 02 '15

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