top of page

Dashboard Refresh Button

In order to refresh all widgets in a dashboard, we need to refresh the entire page. But we can add a button to refresh all widgets.


Here is a script to add refresh button for a dashboard.




Steps:

  1. Create dashboard

  2. Add below script to dashboard

  3. Save the script and refresh the dashboard


dashboard.on('initialized', function (se, ev) {
	
	let dashboardRefreshButton = 
		`<button id="dashboard-refresh-button"title="Refresh" class = "btn js--btn-action" style="width: 34px; height:28px">
		 ↻
		 </button>`
	
	let $toolbarRight = $('.prism-toolbar__section--right .prism-toolbar__cell.btns-holder');
	$toolbarRight.prepend(dashboardRefreshButton);

	$toolbarRight.find('#dashboard-refresh-button').on('click', dashboardRefresh);
})

function dashboardRefresh() {	
	$.each(dashboard.widgets.$$widgets, function(index, value){
		value.refresh()
	})
}   



254 views0 comments

Recent Posts

See All
bottom of page