Article
Automatic scrolling of widgets on a Dashboard page (charts, analytics, dashboard tiles)
18:05 Sep 27, 2018
Question
We want to use a flatscreen to display dashboards, but not all dashboards are visible on the screen. How can I add automatic scrolling of a page?
Answer
You can create your own widget and describe the necessary logic in javascript language in it. Initiate it in the nit() method of the widget. Add it to the widget page.
To implement this:
1) Create a module in the configuration (do not specify the parent module) - for example, UsrDashboardHelper.
2) Save the module and reload the application.
3) Select the widget in the report edit mode.
An example of a simple widget that scrolls the report page up and down automatically every 5 seconds:
define("UsrDashboardHelper", ["ext-base", "terrasoft", "sandbox"], function(Ext, Terrasoft, sandbox) { var getView = function() { var config = { id: "UsrDashboardHelper", selectors: { wrapEl: "#UsrDashboardHelper" }, items: [] }; return Ext.create("Terrasoft.Container", config); }; return { timerId: 0, flag: 0, myTimer: function() { console.log("tik."); if (this.flag === 0) { window.scrollTo(0,800); this.flag = 1; } else { window.scrollTo(0,0); this.flag = 0; } }, init: function() { console.log("UsrDashboardHelper init in: " + sandbox.id); this.timerId = setInterval(this.myTimer, 5000); }, render: function(renderTo) { var view = getView(); view.render(renderTo); }, destroy: function() { console.log("UsrDashboardHelper is offline."); clearInterval(this.timerId); } }; });