Skip to content

Instantly share code, notes, and snippets.

@Azsaturndx
Created October 12, 2020 18:29
Show Gist options
  • Save Azsaturndx/17111684463b64cf06f1fd0e290b8cd0 to your computer and use it in GitHub Desktop.
Save Azsaturndx/17111684463b64cf06f1fd0e290b8cd0 to your computer and use it in GitHub Desktop.
Refresh a Grid periodically - Code onTime
/**
* Reloads a dataView every periodically
* (Code onTime)
* AzsaturnDx (2020) - No copyright at all
*
* Reload data from the contextDataview
*
* Implementation:
* 1.- Copy this to a file.
* 2.- Copy this file to (...)/app/js/
*/
//Refresh time in seconds
var refreshInterval = 30;
refreshGrid();
function refreshGrid() {
setTimeout(function () {
//Use this if you know the controller's name
Web.DataView.find('Contratado_Admin').refresh();
//Or this, if you just want to reload data from current view:
//$app.touch.contextDataView().refresh();
refreshGrid();
},
refreshInterval * 1000
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment