How to: Enable automatic refresh of Analyst Views
This guide explains how you can implement an automatic refresh functionality for defined Analyst Views
Step-by-Step guide
- Create a copy of the View Areas/Analyst/Views/View/GridViewType.cshtml
- Name your copy
GridViewType_custom.cshtml
- Add the following content at the end of your custom file:
For Version 3.6.0+2 and earlier
<script>
//Add Views here with pathname and refresh interval (ms)
var refreshViews = {
"/Analyst/View/Open/3945c73d-1f32-e621-4524-d6867d9c6da9" : 5000,
"/Analyst/View/Open/c45ffc0a-5eb1-cda2-6423-3efb3beb5d73" : 10000
};
//Do not modify anything below
var refresh = function () {
try{
angular.element(@viewElementId).scope().refreshView();
}
catch(err){}
initAutoRefresh();
};
var initAutoRefresh = function () {
if(refreshViews[window.location.pathname]){
setTimeout(refresh, refreshViews[window.location.pathname]);
}
};
window.onhashchange = initAutoRefresh();
</script>
For Version 3.7.0 and later
<script>
//Add Views here with pathname and refresh interval (ms)
var refreshViews = {
"/Analyst/View/Open/3945c73d-1f32-e621-4524-d6867d9c6da9" : 5000,
"/Analyst/View/Open/c45ffc0a-5eb1-cda2-6423-3efb3beb5d73" : 10000
};
//Do not modify anything below
var refresh = function () {
try{
angular.element(@viewElementId).scope().searchGrid();
}
catch(err){}
initAutoRefresh();
};
var initAutoRefresh = function () {
if(refreshViews[window.location.pathname]){
setTimeout(refresh, refreshViews[window.location.pathname]);
}
};
window.onhashchange = initAutoRefresh();
</script>
- Modify the variable "refreshViews" to fit your needs.
- Add the View-url of the View you want to refresh
- Set the Interval in milliseconds
The Example code above will refresh the "All Incidents" View every 5 seconds and the "All Change Requests" View every 10 seconds