Listbox change row background color

asked 2021-03-08 20:56:23 +0800

sebyc gravatar image sebyc

updated 2021-03-09 11:00:23 +0800

cor3000 gravatar image cor3000
6280 2 7

Hi, i have a listbox that display some rows. I want different background color for some rows, depending on some switches. For example :

<template name="default" var="rata">
  <listitem style="${vm.getRowBackColor(rata)}">

where vm.getRowBackColor(rata) return the background color i want for that row.

It run very well under ZK 8.6.3 , but not in ZK

Please, can you help me to fix that problem ? I want to upgrade ZK. Thank you in advance.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-03-09 14:24:46 +0800

cor3000 gravatar image cor3000
6280 2 7

updated 2021-03-09 14:32:31 +0800

since you didn't mention which theme you're using (maybe a custom theme?) I used the default themes to test this (breeze and iceblue/_c)

Here a zkfiddle showing the problem happens in both and the latest 9.5.1 (also with different themes) https://zkfiddle.org/sample/1q65jls/1-listitem-background-color

The background color is always defined by the css rule in zk.wcs:

.z-listitem .z-listcell {
  background: #FFFFFF;

If you specify a background-color at listitem level it will just be hidden by the cell background color.

In order to reset the listcell background you can add the following style:

.z-listitem .z-listcell {
   background-color: initial;

as shown in this example:


However this can't explain why this has worked before in your application. (I could imagine a custom theme, or additional style overrides that no longer apply in the same way as before - this will become obvious when looking into the browser's developer tools and compare the styles before and after upgrading). Those make it easy to analyse which styles apply to which elements and in which order.

(If you still have questions and can't share the full details in public, please contact our support)

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

1 follower



Asked: 2021-03-08 20:56:23 +0800

Seen: 12 times

Last updated: Mar 09 '21

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