0

Listbox change row background color

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

sebyc gravatar image sebyc
1

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

cor3000 gravatar image cor3000
5833 2 7
ZK Team

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

<listbox>
.....
....
<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 9.5.0.2.

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
0

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

cor3000 gravatar image cor3000
5833 2 7
ZK Team

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 8.6.3.1 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:

https://zkfiddle.org/sample/1q65jls/2-listitem-background-color

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

Follow
1 follower

RSS

Stats

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

Seen: 11 times

Last updated: Mar 09

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