add function to checkbox if it is unchecked

asked 2013-05-28 08:44:47 +0800

demizon gravatar image demizon
169 1 6

Hi, I bind function to checkbox when it is checked and it works well but i want also to bind function if the checkbox is unchecked. It should work like this: when chcekbox is checked-> list all items(this works fine atm), when its unchecked list only active items (which doesnt work). I am looking forward for your help.

relevant part of my code...

zul file:

<checkbox onCheck=@command('changeToAll') label="Show all items"/>

viewmodel file:

    public void changeToAll(){
        kundeList = kundeService.changeToAll();

so my question how to bind checkbox to other @Command when its unchecked?

delete flag offensive retag edit


Got it, thx!

demizon ( 2013-05-28 11:18:54 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-05-28 10:29:18 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8

You can code like this...

<checkbox checked="@bind(myViewmodel.bindCheckBox)" onCheck="@command('onCheckedAndUnchecked')" />

What the issue here onCheckedAndUnchecked method will call on both condtion when you will click on Checkbox and when you will unchecked it again

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

1 follower



Asked: 2013-05-28 08:44:47 +0800

Seen: 45 times

Last updated: May 28 '13

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