VamC
VamC

Reputation: 53

Oracle Apex change row color

Using below, I'm able to change the background color the column in APEX classic report.

#static_id td[headers="TOTAL"]{background: rgb(164, 164, 164) !important;}

How do I change the background color of a row? In this case, I want to change the color of my last row (Totals) Screenshot

Upvotes: 1

Views: 5112

Answers (2)

user20238440
user20238440

Reputation: 11

Here n=column number, u can simply put this CSS code in inline section

td:nth-child(n)
{
background-color: blue;
}

Upvotes: 1

Littlefoot
Littlefoot

Reputation: 142720

I don't have Apex 5.1 any more; tested this on apex.oracle.com which currently runs Apex 22.1.0.

Classic report query:

select 1 rn, ename, job, sal
  from emp 
  where deptno = 10
union all
select 2 rn, 'Total', null, sum(sal)
  from emp
  where deptno = 10
order by rn, ename

Create a dynamic action:

  • Name: da_total_bkg_col
  • Event: After Refresh
  • Selection Type: Region
  • Region: Report 1 (that's the name of region that contains that query)

True condition:

  • Action: Execute JavaScript code

  • Code:

     $('td[headers="ENAME"]').each(function() {
       if ( $(this).text() === 'Total' ) {
         $(this).closest('tr').find('td').css({"background-color":"red"});
      }
    });
    
  • Affected elements: type = Region, Region = Report1

  • Fire on initialization: yes

Run the page; the result looks like this:

enter image description here

Upvotes: 5

Related Questions