bebca1
November 3, 2021, 6:56pm
1
How/ where to use setInterval please.
I found feat: setInterval and clearInterval support by hetunandu · Pull Request #8158 · appsmithorg/appsmith · GitHub but after trying it in a few places (yes I have data setup - but it’s Firestore not MySQL) it doesn’t seem to validate. I just get “setInterval is not a function”.
I can get the data into a table, no problem. I just can’t add setInterval and live/ reatime data is the whole reason I am using AppSmith, I didn’t even consider that it wouldn’t be a feature that data from (specifically) Firebase isn’t updated.
Surely a ‘webapp’ is the kind of thing to have live data/ workers/ web socket as standard, in comparison to a normal static webpage?
Also reference in: Having a query table automatically update and reflect new values in the database - #3 by bebca1
FYI I’m on AppSmith Cloud
vihar
April 4, 2022, 10:16am
2
Hey @bebca1 , sorry for the delayed response, you can use setInterval
function to automatically update data on widgets from queries.
Here is the documentation for this: https://docs.appsmith.com/framework-reference/intervals-time-events#setinterval
vihar
April 4, 2022, 10:31am
3
Please find a more detailed example here:
Interval events (Timing functions in JavaScript) allow the user to run APIs and DB queries periodically. You can configure these using the setInterval and clearInterval functions.
Say you want to update data on Table without re-running the API / or using a refresh button, you can use the setInterval function.
In this example, we’ll be using the switch widget (Switch1) to control this function and a table widget that uses the getData query.
Now on Switch1 widget’s onChange property, we use the…