An elegant method to highlight the currently selected row in a report.
Setup (see Code section below for more details):
- For Target, use: Page in this Application.
- For Page, use: &APP_PAGE_ID.
- Open the Column Attributes page for the column that is used to select the record.
- In Column Link – Link Attributes, use: id="XXX#ID#", where XXX (e.g. EMP) is the alias of the identifying table, and ID (e.g. EMPNO) is the primary key of the table. In this example: id="EMP#EMPNO#'.
- In Column Link – Item 1, set the item that contains the id of the row to be highlighted. In this example, set P1047_EMPNO to #EMPNO#.
Since Apex 19.2, the JQuery solution to highlight the entire row instead of just one cell doesn't work anymore for Interactive Reports. See notes below for details.
- Avoid using rowid for ID, since rowid can contains characters that are illegal in urls. If you really have to use rowid, convert it to something legal, e.g. using rawtohex(rowid).
- Make sure you use a template for the report region; do not use No Template, the dynamic action will not work if you do!
- The previous method used this line of JQuery to highlight the row: $('#EMP&P1047_EMPNO.').parent().parent().css('background-color','#FFBB44'); - to highlight only the cell, remove 1 parent()).
This still works for Classic Reports, but I thought it would be best to have a generic solution. The old method is still included (as a comment) in the Dynamic Action.
The 'background-color' and '!important' CSS settings used by Apex itself interfere with the Dynamic Action, causing some of the color changes to fail. The new solution described here works fine again, for all reports.
- And as a bonus, the new method handles Row Highlights better; see the "Row Highlight 7521" example in this report. Previously, the Row Highlight overruled our changes.