0

@template with more than two outcomes?

asked 2013-07-08 15:06:51 +0800

davout gravatar image davout
1435 3 18

Is it possible to have a MVVM @template annotation that supports more than two outcomes?

The example shown below is taken from the ZK reference docs:

<combobox model="@bind(item.options ) @template(forEachStatus.index eq 0 or forEachStatus.index eq 2?'model1':'model2')">

... however, this only supports two outcomes: 'model1' and model2'. Can I have a situation where there are more than two template name outcomes? My specific situation will require around six different template names.

Alternatively can I drive @template from a bind bean property value?

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-07-09 06:14:17 +0800

nsharma gravatar image nsharma flag of India
917 1 11

updated 2013-07-09 06:17:26 +0800

Try using switch case:-

 <zk switch="${each}">
       <zk case="0">
        <--your code-->
        </zk>
            <zk case="1">
                <--your code -->                                                
       </zk>
            <zk case="2">
              <--your code -->  
       </zk>
            <zk case="3">
                 <--your code -->   
      </zk>
    </zk>
link publish delete flag offensive edit

Comments

Nice idea, but its not very MVVM

davout ( 2013-07-09 20:09:14 +0800 )edit

i didn't get your above comment.can you explain it a bit.

nsharma ( 2013-07-10 05:56:31 +0800 )edit
0

answered 2013-07-17 21:11:43 +0800

khcyt gravatar image khcyt
216 1 1

Hello davout,

this question I have already answered once for you.

Search for "How to define three or more models for use within a MVVM Tree?"

Kai

link publish delete flag offensive edit

Comments

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-08 15:06:51 +0800

Seen: 19 times

Last updated: Jul 17 '13

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