问题
I used the query below in interactive report and turned escape special characters off. This is just coloring text whereas requirement is to highlight entire row.
Any suggestions?
Ex:
SELECT "P_IT_ISSUES"."ISSUE_SUMMARY" as "ISSUE_SUMMARY",
decode("P_IT_PEOPLE_1"."PERSON_NAME",NULL,'Unassigned',
"P_IT_PEOPLE_1"."PERSON_NAME")
as "ASSIGNED_TO",
case when "P_IT_ISSUES"."STATUS" ='Open'
then '<aaab style= " color: green; " >'
||"P_IT_ISSUES"."STATUS"||'</aaab>'
when "P_IT_ISSUES"."STATUS" ='On-Hold'
then '<aaab style= " color: red; " >'
||"P_IT_ISSUES"."STATUS"||'</aaab>'
else '<aaab style= " color: red; " >'
||"P_IT_ISSUES"."STATUS"||'</aaab>'
end "Status"
FROM "P_IT_PEOPLE" "P_IT_PEOPLE_1",
"P_IT_DEPARTMENTS" "P_IT_DEPARTMENTS",
"P_IT_PEOPLE" "P_IT_PEOPLE",
"P_IT_ISSUES" "P_IT_ISSUES"
WHERE "P_IT_ISSUES"."IDENTIFIED_BY_PERSON_ID"="P_IT_PEOPLE"."PERSON_ID"
AND "P_IT_ISSUES"."ASSIGNED_TO_PERSON_ID"="P_IT_PEOPLE_1"."PERSON_ID"(+)
AND "P_IT_ISSUES"."RELATED_DEPT_ID"="P_IT_DEPARTMENTS"."DEPT_ID"
回答1:
I need to do a revised version of this post http://www.grassroots-oracle.com/2013/06/highlight-cell-background-in-apex-report.html
To highlight the entire cell/row, you need to apply a conditional class to your column, similar to how you're doing now - but could be a simple value.
First, add a hidden column to your query.
case when status = 'X' then 'foo' else 'bar' end my_class
which you would add as HTML expression of a visible column, eg: the status column.
<span class="#MY_CLASS#">#STATUS#</span>
Then have an after-refresh dynamic action with JS, ensuring 'fire in initialisation' is checked. This JS looks for any elements with that class, then climbs the DOM to find the relevant cell/row, and applies a colour to the row.
$("#my_report_static_id .foo").each(function(){
$(this).closest('tr').css({"background-color":"red"});
});
You could parameterise that colour, if necessary, using similar techniques.
来源:https://stackoverflow.com/questions/61505073/oracle-apex-column-value-conditional-display