0

Listcell: load style color on @bind record

asked 2014-11-16 16:56:09 +0800

lramellavotta gravatar image lramellavotta flag of Italy
200 1 8

Hi, It is possible to load, like example, load a value for background-color of a listcell?

listcell label="@bind(Item.descrizione)" style="'background-color: ' @load(Item.colore_appuntamento) ';'"

Thanks, Luca

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2014-11-16 18:40:28 +0800

Darksu gravatar image Darksu
1991 1 4

Hello lramellavotta,

You could try it by setting a variable to your model class, and assigning to that variable the exact css you wish to apply.

For example:

Zul File:

<label style="@load(item.cssText)">Test CSS!!!</label>

Java Class:

Set the variable with the following css: "background-color: yellow;"

And it will work.

If you wish i can provide a full project sample.

Best Regards,

Darksu

link publish delete flag offensive edit
3

answered 2014-11-17 09:20:34 +0800

cyiannoulis gravatar image cyiannoulis
1191 10

Something like the following should do the trick:

<cell  style="@load(bean.backgroundColor)">

where the getter getBackgroundColor() should return something like 'background-color: #fff'

Or better you may use a conditional change of color directly inside the zul. For example if the 'age' of the object is less than 20 then change the background to #FFCCCC else use the default:

<cell style="@load(bean.age lt 20 ? 'background-color: #FFCCCC;' : '')">

Hope that helps

Costas

link publish delete flag offensive edit

Comments

+1 for the extra conditional explication ;)

chillworld ( 2015-01-09 15:42:11 +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
2 followers

RSS

Stats

Asked: 2014-11-16 16:56:09 +0800

Seen: 42 times

Last updated: Nov 17 '14

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