Search code examples
oracle-apex

change row background color based on column value in classic report in oracle apex


Is there a way to programmatically set the background color of a row based on data on column (exp . mgr =100 the row color green other that blue ....ex ). Is there a method (javascript?) by which this can be achieved? Regards


Solution

  • You can do this with a combination of page inline CSS and "execute when page loads" Javascript like this:

    Page inline CSS

    #myreport td {background-color: #aaccff}
    

    "Execute when page loads" Javascript

    $('#myreport td[headers="MGR"]').filter(function(){
        return $(this).text() === '100'
    }).parent().children().css('background-color', '#aaffaa');
    

    Here myreport is the static ID you assigned to the report region.


    Another way without Javascript would be to build a bespoke report template with conditional column templates where one has the PL/SQL condition:

    '#MGR#' = '100'