Oracle Apex column value conditional display

时光毁灭记忆、已成空白 提交于 2020-05-17 06:33:19

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!