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
5357 4 9

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)">
    <listcell if="${item.typenotif=='FALSE'}" style="text-align:center;">
        <label sclass="btn btn-round btn-danger" value="@load(item.notification)">
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

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
5357 4 9

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)"/> 
link publish delete flag offensive edit


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

1 follower



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

Seen: 61 times

Last updated: Jun 17 '15

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