Be it a database table or an external API, Toolpad offers mechanisms to bring server-side data to the page.
You can create two kinds of queries in Toolpad to bring data to your page.
- HTTP request
- Custom functions
You can set the mode of the query to either be automatically refetched on page load, or only be called on manual action.
Setting the query mode
You can configure the following settings in this mode:
You can use this option to enable or disable the query from running
You can configure the query to run on an interval, for example every 30s. To disable this option, keep the field empty.
Queries set to the automatic mode may be re-fetched via the
refetchfunction available on these query objects. For example, for a query named
getOrders, we can add
onClickbinding of a Button component.
createCustomer, we can add
onClickbinding of a Button component. This will trigger this query when the Button is clicked.