-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi all,
I need help, i tried to use toolbarbutton with MVVM pattern
in .zul file i use something like this
<toolbarbutton checked="@bind(checkVar)" mode="toggle">
all works fine, but value of checkVar not updates in VM-object,
Anyone knows what's wrong?
There is some more complex code:
ZUL part:
<window apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('org.romanz.TestVM')">
<toolbar>
<toolbarbutton label="@bind(vm.btnName)"
checked="@bind(vm.checkedValue)"
visible="@bind(not empty vm.btnName)" mode="toggle"/>
<toolbarbutton label="Show values" onClick="@command('showValues')"/>
</toolbar>
</window>
Java part:
public class TestVM {
private boolean checkedValue;
private String btnName;
public TestVM(){
//Some initial values
checkedValue = true;
btnName = "Test button";
}
//Getters & setters skipped
@Command
public void showValues(){
System.out.println("checkedValue is "+ checkedValue);
}
}
On start Toolbarbutton looks fine (checked attribute value loading). But, when I press toolbarbutton - property in Java not changes. (showValue() method print only initial value of checkedValue)
P.S. I use zk 6.5.1.1
It is a bug, please follow http://tracker.zkoss.org/browse/ZK-1666
Asked: 2013-03-04 10:12:57 +0800
Seen: 59 times
Last updated: Mar 13 '13
You have to share more code with us.
sjoshi ( 2013-03-04 12:08:18 +0800 )editi added some code to firs post, Thanks for answers
romanz ( 2013-03-04 19:04:23 +0800 )editthanks for support, Dennis
romanz ( 2013-03-13 05:02:40 +0800 )edit