Default IR Search Column

If you want to default the search column in an Interactive Report, you can easily accomplish this with a Dynamic Action on the After Refresh event of your IR. This way instead of the report searching all columns, it will search the one you set it to (unless the user selects something different, of course)

No default    With Default Column

Dynamic Action: Set Default IR Search Column
Event: After Refresh
Selection Type: Region
Region: select the IR region on your page
Condition: JavaScript expression with the code:

True Action: “Execute JavaScript Code” with the following code:

Make sure it does fire on Page Load.

There are two values that need to be set. What the user sees on the screen “apexir_SEARCH_COLUMN_DROP” and what the IR will use as a column “apexir_CURRENT_SEARCH_COLUMN”, make sure this last one matches your column name.

By using the After Refresh event we make sure the default search column is set again after the report refreshes.


UPDATE March 15, 2017: If you’re on APEX 5.0 or later and need to remove the “All Columns” option, use this line of code provided by John Snyders. His blogs on working with the menu widget will help you a lot.

Hi, I'm Jorge Rimblas. Father, husband, photographer, Oraclenerd, Oracle APEX expert, Oracle ACE, coffee lover, car guy, gadget addict, etc... I'm a Senior APEX Consultant with Insum Solutions, a consulting firm specialized in Oracle databases and the APEX development tool. I have worked with Oracle since 1995 and done eBusiness Suite implementations and customizations. Nowadays I specialize almost exclusively in Oracle APEX.

4 comments on “Default IR Search Column
  1. Graham Boyle says:

    Needed to learn about Dynamic Actions to use this – done
    Technique works
    ++Pleased

  2. oklimberg says:

    Had to update the code a little bit for APEX 5.

    the hidden item containing the column is now called ‘_column_search_current_column’.

    To set the placeholder as well, you need to call
    $(‘#e_search_field’).attr(“placeholder”, “Search: “);
    as well in the True Action.

    • Great! Thanks for sharing

    • oklimberg says:

      Okay the formatting seems to have stripped some of the characters of my comment.
      Trying it again:

      change ‘$$REPORT_STATIC_ID$$_CURRENT_SEARCH_COLUMN’ to ‘$$REPORT_STATIC_ID$$_COLUMN_SEARCH_CURRENT_COLUMN’

      And call $(‘#$$REPORT_STATIC_ID$$_search_field’).attr(“placeholder”, “Search: $$COLUMN_TITLE$$“); to set the placeholder.

      The $$…$$ parts need to be adjusted depending on your report / page.

I love comments, write me a line