I have a list of devices that require regular updates to monitor their display. I've set the poll interval to 15,000ms. However, every time the list is updated, there is a quick flicker and the user is taken back to the top of the list. Is there a way to prevent this behavior while still polling the devices?
Poller:
let deviceCurrentRequestsFormatter = function (value: any, row: any, index: number) {
let __this = this;
let requests = $tcore.utilityTIS.filterBySiteIdIntId(_this.deviceCurrentRequestsList, row.SiteId, row.IntId);
if (requests && requests.length) {
let sources = _.find(requests, function (request) {
return request.SourceType === __this.field;
});
if (sources && sources.Enabled)
return "<i class=\"fa fa-check tc-check-color\"></i>";
}
return "";
};
this.pollInterval = setInterval(function () {
_this.getDeviceBrowserList();
console.log("%c This is polling: ", "background: red; color: yellow; font-size: x-large")
}, 15000);
setTimeout(function () {
_this.getDeviceBrowserList();
}, 1000);
}
What the poll is looking at:
private getDeviceBrowserList() {
let _this = this;
this.widgetObject.parentEntity.getDeviceBrowserList().then(function (message: any) {
if (message) {
_this.deviceBrowserList = message.Device;
_this.deviceTypeList = message.DeviceType;
_this.deviceCurrentRequestsList = message.DeviceCurrentRequests;
if (_.isUndefined(_this.pageSize)) {
_this.pageSize = 10;
}
_this.checkPrivilegeAccess(0, _this.pageSize).then(function() {
_this.buildDeviceBrowserListTable(message.Device, message.DeviceType, message.DeviceCurrentRequests);
_this.widgetObject.parentEntity.getFonts().then(function (data: any) {
$tcore.utilityTCS.showOrHideProgres(false);
});
});
}
});
}