-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Starting from ZK 6.0.2.1 (actually I'm evaluating 6.5 version) I have problems with value of parameters passed to init methods of a viewmodel.
I used the example in the documentation of @SelectorParam (http://books.zkoss.org/wiki/ZK%20Developer's%20Reference/MVVM/Syntax/ViewModel/Parameters/@SelectorParam) and modified the code of the VM to test the issue:
public class SelectorParamVM { @Init public void myInit(@SelectorParam("label") LinkedList<Label> labels, @SelectorParam("#message") Label msg) { for (int i = 0; i < labels.size(); i++) { labels.get(i).setValue("Command " + i); } msg.setValue("init"); } @Command public void cmd(@SelectorParam("label") LinkedList<Label> labels, @SelectorParam("#message") Label msg) { for (int i = 0; i < labels.size(); i++) { labels.get(i).setValue("Command " + i); } msg.setValue("msg in command"); } }
labels and msg are null in myInit.
Why?
Use @AfterCompose, when @Init, it is too early to get subsequence children component.
Asked: 2012-09-17 10:04:53 +0800
Seen: 91 times
Last updated: Sep 17 '12