0

Conditional evaluation component in mvvm

asked 2013-07-19 19:04:58 +0800

grzesiek gravatar image grzesiek flag of Poland
72 1 5

updated 2013-07-19 19:13:03 +0800

Hello ZK Users

I'm using MVVM pattern but I don't know how to use conditional evaluation of components, below is my problem:

I have zul file:

<zk>

<button label="Click me" visible="@load(vm.visibleButton eq 'true' ? 'true' : 'false')"/>
</zk>


and view model

public class LoginVM {
private boolean visibleButton;

@init
public void init() {
    visibleButton=false;
}}

this solution work correct, but it is simple to uncover the button in browser for example in firebug:

button id="v8CP1" class="z-button-os" style="display:none;" type="button">Click me</button<>


so I'd like do something like:

<zk>

<button label="Click me" if="@load(vm.visibleButton eq 'true' ? 'true' : 'false')"/>
</zk>

but it's not working if the value of visibleButton is 'true' or 'false' always the button is not created

please help

delete flag offensive retag edit

3 Answers

Sort by ยป oldest newest most voted
0

answered 2013-07-22 02:09:15 +0800

vincentjian gravatar image vincentjian
2245 6

Hi

Please check the document for reference.

link publish delete flag offensive edit
0

answered 2013-07-22 11:15:20 +0800

grzesiek gravatar image grzesiek flag of Poland
72 1 5

the correct code should look like:

button label="Click me" if="${vm.visibleButton}"

and it is working perfect

thanks for the clue

link publish delete flag offensive edit
0

answered 2013-07-22 12:27:15 +0800

miks gravatar image miks
0
public class LoginVM {
    private boolean visibleButton;

    @init
    public void init() {
        visibleButton=false;
    }

    public boolean getVisibleButton() {
        return this.visibleButton;
    }
}

zull file:

<zk>
    <button label="Click me" visible="@load(vm.visibleButton)"/>
</zk>
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-07-19 19:04:58 +0800

Seen: 112 times

Last updated: Jul 22 '13

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