I think I need to share this code too especially for the beginners who want to update a repeater that’s connected to a dataset. To clarify it: The $w(‘#datasetName’) is used to select an element on the page. And “.refresh()” is used for refreshing the selected element. Make sure you don’t include the parentheses for the first code. The 3000 will be the time (milliseconds) set for the code to refresh the element.
1-) CODE TO REFRESH A REPEATER CONNECTED TO A DATASET IN EVERY 3 SECONDS:
$w.onReady(function (){
setInterval($w('#datasetName').refresh, 3000)
});
2-) DEFAULT CODE TO REFRESH A REPEATER CONNECTED TO A DATASET IN EVERY PAGE REFRESH (WON’T REFRESH THE REPEATER AUTOMATICALLY):
$w.onReady(function (){
$w("#datasetName").refresh()
});
So for this example, the main method to differentiate the “.refresh()” capability is to either use it in a “setInterval” in the correct format or directly use it with only a “$w”.
The “#datasetName” is visible when you click the element you want to refresh (in this case, even though we’re refreshing the data in the repeater since it’s connected to the dataset, we must select the element of the dataset). You’ll see the “ID” section on the right side.
If the “ID” section isn’t there, the “Dev Mode” is probably turned off. To turn it on, click “Dev Mode” on top of the page and click “Turn on Dev Mode”.