简体   繁体   中英

Change column color in Oracle apex

How can I change the background color of every second column using interactive report.

我有4列。第二栏必须为蓝色,第四栏必须为红色

First of all I recommend using css. If you don't like CSS just go directly to IR section in my answer

CSS

th:nth-child(even),
td:nth-child(even){
  background-color: red !important
}

or

th:nth-child(2),
td:nth-child(2) {
  background-color: red !important
}

th:nth-child(4),    
td:nth-child(4) {
  background-color: blue !important
}

or

th#C152380905075548116,
td[headers="C152380905075548116"] {
  background-color: red !important;
}

th#C152381026269548117,    
td[headers="C152381026269548117"] {
  background-color: blue !important;
}

where C152380905075548116 and C152381026269548117 are columns id that should be replaced.

IR

If you really need to use native IR functionalities you should follow 3 steps:

  1. Change report SQL query so the column contains name of the color you want to use as background

eg:

select
  ...
  VALUE1||'<span style="display: none">red</red>' as Artikl
  VALUE2||'<span style="display: none">blue</red>' as "Broj gresaka"
  ..
from
  ..
  1. Add IR highlights Actions > Format > Highlight

Name = Red background (Artikl)

Sequence = Sequence

Enabled = Yes

Highlight Type = Cell

Background Color = #FF7755

Text Color = null

Column = Artikl

Operator = Contains

Expression = red

and

Name = Blue background (Broj gresaka)

Sequence = Sequence

Enabled = Yes

Highlight Type = Cell

Background Color = #99CCFF

Text Color = null

Column = Artikl

Operator = Contains

Expression = blue

  1. Set columns attribute Security > Escape special characters to No

It is not the perfect solution but it works :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM