0

Data Binding and Events

asked 2010-03-09 09:18:59 +0800

Matze2 gravatar image Matze2
773 7

Consider a bunch of components which get their values from databinding and all have an onChange event handler assigned to setup other components.

Example:
<textbox id="A" value="@{win$composer.valueA}" forward="onChange=onAnyFieldChange"/>
<textbox id="B" value="@{win$composer.valueB}" forward="onChange=onAnyFieldChange"/>
<textbox id="C" value="@{win$composer.valueC}" forward="onChange=onAnyFieldChange"/>
<textbox id="D" value="@{win$composer.valueD}" forward="onChange=onAnyFieldChange"/>

onAnyFieldChange fills - say another 4 - components:

public void onAnyFieldChange() {
// compute some new values out of the textboxes A,B,C,D
textboxE.setValue(valueE);
textboxF.setValue(valueF);
textboxG.setValue(valueG);
textboxH.setValue(valueH);
}

Now the problem: when the window opens, all four text boxes A,B,C,D are correctly filled with their values but the onChange handler is not called. So the text boxes E,F,G,H remain empty.
The initial loading via data binding is done after doAfterCompose() method, so how can I get the onAnyFieldChange() method called to get the textboxes E,F,G,H filled?

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2010-03-10 02:54:27 +0800

jumperchen gravatar image jumperchen
3909 2 8
http://jumperchen.blogspo... ZK Team

The onChange will be triggered from client side or by Event.post().
In your case, you may try to use "onCreate=onAnyFieldChagne" with onChange together.

link publish delete flag offensive edit

answered 2010-03-11 03:32:33 +0800

Matze2 gravatar image Matze2
773 7

Hey, this seems to do it.
I would not have expected that an "onCreate" event is fired after initial data binding load happened.
Meanwhile I changed the example in that way, that I really use data binding for all text boxes together with some load-after instructions.
I have a second use case, where I can try your solution and probably I'll change also the first use case back, then.
Thank you very much.

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: 2010-03-09 09:18:59 +0800

Seen: 443 times

Last updated: Mar 11 '10

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