How do I refresh table after adding new data using an API/Query?

This question was asked on our Discord by one of our users; following is the use-case:

How can we refresh the table data after a new row is inserted via a query or an API?


This can be done in two ways. First, we could either run the GET/SELECT query onto the table after running the POST/INSERT INTO query; the following is a JS snippet that’s set to the button’s widget onClick property that’s linked with a form.

{{addqQery.run(() => {
    getQuery.run();
}, () => {})}}

Second, we could use the setInterval function on Appsmith to automatically update the table based on a certain time interval. More details here: