> For the complete documentation index, see [llms.txt](https://docs.avonnicomponents.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/tips-and-tricks/enabling-auto-refresh-on-the-data-table-when-pressing-a-button.md).

# Enabling auto-refresh on the Data Table when pressing a button

Reload the rows of a screen flow Data Table from a Refresh button in its header, or on its own when a dialog flow finishes, without restarting the flow.

A sales manager keeps the open deals screen up during the forecast call while reps update their opportunities. The table read its rows when the screen opened, so it now shows yesterday's amounts. A **Refresh** button in the table header reads the rows again on demand. The same **Refresh Query** interaction also runs on its own when a dialog flow finishes, so a reassigned deal shows its new owner at once.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FjsM3r1EQ7Ryhg7vDMoff%2Fdata-table-tutorial-enabling-auto-refresh-on-the-data-table-when-pressing-a-button-result.png?alt=media" alt="Data Table titled Open opportunities with a Refresh button in its header"><figcaption><p>A Refresh button reloads the table without restarting the flow.</p></figcaption></figure>

## Before you start

* The Data Table uses the **Query** data source. **Refresh Query** reloads that query, so it is not offered with **Manual** or **Variable**. A table fed by a Get Records collection has its own method: see [With a Get Records collection](#with-a-get-records-collection).
* For the automatic refresh: a row action or button that opens another flow. [Creating Row Actions](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/creating-row-actions.md) sets one up.

## Steps

{% stepper %}
{% step %}

### Add a Refresh button to the header

1. Select the Data Table on the screen and click **Open Component Builder**.
2. In the **Properties** tab, open the **Header** group and give the table a **Title**, for example `Open opportunities`.
3. Under **Actions**, add an item with **Label** `Refresh`, **Name** `refresh` and **Icon Name** `utility:refresh`.

The button appears at the top right of the table, on the title row.
{% endstep %}

{% step %}

### Make it reload the query

1. Go to the **Interactions** tab and add an interaction under **Header Action**.
2. Set **Target Name** to `Refresh`.
3. Set **Type** to **Refresh Query**. There is nothing else to fill in: it reloads this Data Table's own query.
   {% endstep %}

{% step %}

### Refresh automatically after a dialog

Open the interaction that runs the other flow (**Open Flow Dialog** or **Open Flow Panel**, on a row action, a button or a header action). It has three follow-up lists: **On Finish**, **On Close** and **On Error**.

1. Under **On Finish**, add an item with **Type** **Refresh Query**. The table reloads as soon as the second flow reaches its end.
2. Add the same item under **On Close** if users may close the dialog with the X after saving.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FKM5PYd67J9F7tcMd0oes%2Fdata-table-tutorial-creating-row-actions-interaction.png?alt=media" alt="Row Action interaction opening a flow dialog with the clicked opportunity Id and a Refresh Query on finish" width="320"><figcaption><p>The Change Owner action opens a second flow on the clicked opportunity, then refreshes the table.</p></figcaption></figure>
{% endstep %}

{% step %}

### Save and test

Click **Done**, save the flow and run it with **Debug**. In another tab, change the amount of one opportunity, then click **Refresh**: the row shows the new amount, and the screen and its other components stay as they were. Open the dialog from a row, save, and the row updates when the dialog closes.
{% endstep %}
{% endstepper %}

{% hint style="success" %}
**Edit Selected Record(s)** needs no follow-up. With a **Query** data source, the table reloads its query by itself after a successful save.
{% endhint %}

## Refresh other components on the screen

**Refresh Query** only reloads the Data Table that fires it. To reload every Avonni component with a query on the page (a second table of closed deals, for example), use [Refresh All Queries](https://docs.avonnicomponents.com/flow/component-builder/interactions-panel/refresh-all-queries.md) instead:

| Setting          | When on                                                                                           |
| ---------------- | ------------------------------------------------------------------------------------------------- |
| **Flow Scope**   | Only components in the current flow refresh. Off by default, so every flow on the page refreshes. |
| **Exclude Self** | The component that fires the interaction keeps its data.                                          |

## With a Get Records collection

A table that reads a Get Records collection (**Variable** data source) shows the records the flow held when the screen opened. Only the flow can fetch them again, so send it back through the Get Records:

{% stepper %}
{% step %}

### Leave the screen on the click

Add the `Refresh` header action as above, with a **Flow Navigation** interaction, **Type** **Next Screen**.
{% endstep %}

{% step %}

### Loop back to Get Records

After the screen, add a **Decision** on the Data Table output **Clicked Header Action Name**. When it equals `refresh`, connect back to the Get Records element. It runs again and the screen reopens with fresh rows.
{% endstep %}
{% endstepper %}

## Troubleshooting

<details>

<summary>Refresh Query is not in the Type list</summary>

The Data Table uses a **Manual** or **Variable** data source. Switch it to **Query**, or use the loop described in [With a Get Records collection](#with-a-get-records-collection).

</details>

<details>

<summary>A record disappeared after the refresh</summary>

Refresh Query runs the same query with its current filters. A deal moved to Closed Won no longer matches a table filtered on open deals, so it drops out, as expected.

</details>

<details>

<summary>The table does not update after the dialog</summary>

The **Refresh Query** item sits under **On Finish**, but the user closed the dialog with the X. Add the same item under **On Close**.

</details>

## Related tutorials

* [Creating Row Actions](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/creating-row-actions.md): the row menu and buttons that open the dialogs worth refreshing after.
* [Setting up data export](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/setting-up-data-export.md): another header action, to take the rows to Excel.
* [Enabling auto-refresh for queries after the flow dialog ends](https://docs.avonnicomponents.com/flow/tutorials/interactions/enabling-auto-refresh-for-queries-after-the-flow-dialog-ends.md): the same pattern on other components.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.avonnicomponents.com/flow/tutorials/components/data-table/tips-and-tricks/enabling-auto-refresh-on-the-data-table-when-pressing-a-button.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
