Our UserFrosting (4.2) application has a dashboard page which shows recent data using a ufTable
object. We would like to automatically refresh the table contents every 60 seconds.
The idea is that this table will be displayed on a monitor in the workroom to show the current status of various on-going operations, and we'd like it to automatically refresh just the data without having to add an interval to the entire page itself to refresh the page.
We tried a variety of ways to solve this, including re-initializing the table every x many milliseconds. But, the table doesn't actually refresh upon re-initializing the object as there is a flag in the ufTable
wrapper intended to improve performance by not needlessly re-querying the server. I believe it is this flag that prevents the re-initialization from working.
[Edit] Documentation has been added to support the refresh()
method. Usage below.
It turns out if you examine the source code of the table you'll see a refresh method does exist, but there's no documentation for this in the official documentation. To work around this, use the following code:
$("#your-widget-id").ufTable("refresh");