0

if condition zk

asked 2015-06-16 12:43:15 +0800

Fzacraoui gravatar image Fzacraoui
1 2

updated 2015-06-17 06:35:23 +0800

chillworld gravatar image chillworld flag of Belgium
5347 4 9
https://github.com/chillw...

Hi i want to change color of notifications, this is the code that i'm using in zul file

<listitem visible="@load(not empty each.taches)">
    <listcell if="${item.typenotif=='TRUE'}" style="text-align:center;">
        <label sclass="btn btn-round btn-info" value="@load(item.notification)">
        </label>
    </listcell>
    <listcell if="${item.typenotif=='FALSE'}" style="text-align:center;">
        <label sclass="btn btn-round btn-danger" value="@load(item.notification)">
        </label>
    </listcell>
</listitem>
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-06-16 14:01:42 +0800

WilliamB gravatar image WilliamB
1609 1 6

updated 2015-06-17 06:33:36 +0800

chillworld gravatar image chillworld flag of Belgium
5347 4 9
https://github.com/chillw...

Something like :

<listitem visible="@load(not empty each.taches)">
   <listcell style="text-align:center;">
      <label class="btn btn-round" sclass="@load(item.typenotif eq 'TRUE' ? 'btn-info' : 'btn-danger')" value="@load(item.notification)"/> 
   </listcell>
</listitem>
link publish delete flag offensive edit

Comments

If typenotif is a Boolean he just can do @load(item.typenotif?'btn-info':'btn-danger')

chillworld ( 2015-06-17 06:33:02 +0800 )edit

Yup, but since it was in caps, i went with the postulate it was a String.

Btw Chill thanks for your answers around here.

WilliamB ( 2015-06-17 08:22:44 +0800 )edit

gratefull to do, I just wanted to add the information for later viewers or maybe to reduce his code, because you are correct to keep it like this.

chillworld ( 2015-06-17 09:37:52 +0800 )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: 2015-06-16 12:43:15 +0800

Seen: 57 times

Last updated: Jun 17 '15

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