Search This Blog

Saturday, July 12, 2025

How do I refresh a table with a button

 

Introduction
Refreshing a table or report region with a button in Oracle APEX is a common requirement when building interactive, responsive applications. Whether you're updating a Classic Report, Interactive Report, or Interactive Grid, users often expect the data to refresh after performing an action—such as inserting, updating, or deleting a record—without needing to reload the whole page. In this post, you’ll learn how to configure a button to refresh a report region using dynamic actions, improving both performance and user experience.

 To refresh a table (typically a report region) with a button in Oracle APEX, you can use a Dynamic Action that triggers a Refresh on the specific region. This method avoids a full page reload and provides a seamless experience for the user, especially after data changes such as inserts, updates, or deletions.

Here is a step-by-step guide to implement this:Step 1: Create Your Report Region

  1. In the APEX App Builder, open your application and navigate to a page.

  2. Create a Classic Report, Interactive Report, or Interactive Grid region based on a SQL query.
    For example:

    SELECT * FROM TASKS ORDER BY CREATED_DATE DESC
    
  3. Give your report region a recognizable Static ID.

    • Click on the report region in Page Designer.

    • In the Advanced section, set the Static ID to something like task_report.

Step 2: Add a Button to the Page

  1. In Page Designer, click the region where you want the button to appear (above or below the report).

  2. Click the ➕ icon and select Button.

  3. Set its label to something like Refresh Table.

  4. Set a Static ID for the button (optional but helpful), such as refresh_btn.

Step 3: Create a Dynamic Action to Refresh the Report

  1. In Page Designer, under the Dynamic Actions section, click the ➕ icon.

  2. Name it Refresh Task Report.

  3. Event: Select Click.

  4. Selection Type: Choose Button.

  5. Button: Select the name of your refresh button (Refresh Table or the exact name you gave it).

  6. Under True Actions, click the ➕ icon and choose Refresh.

  7. Affected Elements:

    • Selection Type: Region

    • Region: Select your report region (e.g., task_report).

  8. Save your changes.

Step 4: Run and Test

  1. Run your application.

  2. Perform an insert or any change in data (through a form or process).

  3. Click the Refresh Table button.

  4. The report will reload and display the updated data without a full page reload.

Optional: Add a Process That Modifies Data and Then Refresh

If you want the same button to perform an action (like insert) and then refresh the table:

  1. Create a PL/SQL process (e.g., insert into TASKS) and tie it to the button using a Submit action.

  2. After submit, create a Dynamic Action on Page Load that refreshes the report region.

  3. Or, use a Dynamic Action with two steps:

    • First Action: Execute PL/SQL Code (e.g., insert).

    • Second Action: Refresh the region.

Refreshing a table in Oracle APEX using a button involves assigning a Static ID to the report region and using a Dynamic Action to trigger a Refresh on click. This approach enhances the user experience by eliminating full-page reloads and updating data in real time. With just a few declarative steps, you can add dynamic interactivity to your reports and make your applications more responsive and modern.

The goal id to refresh a table after adding an entry to the table.

Step 1- Add a table region

A screenshot of a computer

Description automatically generated

Step 2 – Name the table

A screenshot of a computer

Description automatically generated

Step 3 – Select the table name

A screenshot of a computer

Description automatically generated

Step 4 – Add a second Dynamic Action to the button

  • Select The action: Refresh

A black and white text

Description automatically generated

  • Affected Elements

    • Selection Type: Region ( the report is a region)

    • Region: Newtable (the name of the report region)

A screenshot of a computer

Description automatically generated

 Conclusion
Adding a refresh button to your APEX application is a simple but powerful way to provide users with real-time updates. By using dynamic actions to target specific report regions, you can avoid unnecessary page reloads and keep your interface responsive and modern. With just a few steps, you enable a smoother workflow that reflects changes instantly, making your APEX applications more intuitive and efficient.

No comments:

Post a Comment

How Do I Make a Faceted Search Map Page in Oracle APEX

Combining faceted search with a map region in Oracle APEX enables users to filter data visually and spatially at the same time. This design ...