0

toolbarbutton and checked property binding

asked 2013-03-04 10:12:57 +0800

romanz gravatar image romanz
3 2

updated 2013-03-04 19:08:11 +0800

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

delete flag offensive retag edit

Comments

You have to share more code with us.

sjoshi ( 2013-03-04 12:08:18 +0800 )edit

i added some code to firs post, Thanks for answers

romanz ( 2013-03-04 19:04:23 +0800 )edit

thanks for support, Dennis

romanz ( 2013-03-13 05:02:40 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-03-11 04:28:25 +0800

dennis gravatar image dennis
3669 1 6
http://www.javaworld.com....

It is a bug, please follow http://tracker.zkoss.org/browse/ZK-1666

link publish delete flag offensive 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: 2013-03-04 10:12:57 +0800

Seen: 59 times

Last updated: Mar 13 '13

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