Refresh Button On Dashboard

Hi,

Is there a way to put a button on a dashboard that refreshes the data, without the user having to hit F5 on the browser or changing a parameter on the report.

Thanks

Tommy

2 Likes

Hello,

Do you want to refresh a visualization?
chart1.loadData();
Or you can put a script on Data Changed to load other filters or visualization.

1 Like

Hi, thanks for that.

So it is just to refresh any data that is on that dashboard, be it a table or chart.

Where do you put this code?

TC

If a button is enough for your case you can put on the click interaction this script for all your data.
In this case you must write the code for all visualization that you have inside the dashboard:
chart1.loadData();
table1.loadData();
etc.

1 Like

Hi Tommy,

You can enable a button to refresh the data on dashboard by adding an interaction to open the same view. To do so,

  • Select the button component on the dashboard and click on ‘Navigate When Pressed’ option from the menu.
    1

  • Under set up a Navigation panel, enter the necessary details such name.

  • Under Navigate select ‘To this same view’

  • Under Open select ‘In the same window’


    You can also set up parameters to send to this view.

  • Submit

Hope this helps

Thank you,

Ankita Goyal | Business System Analyst / Support Associate
Dundas BI

4 Likes

Ankita,

Not to dispute a Dundas rep, but why would you refresh the entire view when you can just refresh individual visualizations or all visualizations using refreshAllAdapters(). From a user-experience standpoint, I find reloading the browser to be much more jarring then simply refreshing the affected areas of the view.

Wayne

1 Like

Hi Wayne,

If i want to use a “refreahalladapters()”, how do I do this. Where do I out it? Can you kindly show me a screenshot?

Tnx

TC

Hi Tommy,

Sorry for the delay. It’s Friday night here in Thailand, so I was at the pub!

First, you obtain a reference to a parameter that is shared among the visualizations…typically, a date parameter:

var dateRangeParameter = dundas.context.baseViewViewService.currentView.control.viewParameters.filter(function(item) {
return item.name === “DateRangeParameter”;
})[0];

Then you simply call the refreshAllAdapters() method:

dateRangeParameter.refreshAllAdapters();

This will update all the affected visualizations (i.e. those connected to the parameter in question) without updating the entire browser window.

If you want to update individual visualizations, use visualization.loadData() instead.

Wayne

Oh, sorry, as for where to do it. You typically attach it to whichever event requires an update. So, typically, I’d create a javascript method called “UpdateAllVisualizations”, and then I’d call this whenever, say, an individual parameter changed (i.e. attach it to the ValueChanged event of all filters associated with said parameters).

Wayne

@ankita Ankita should this work on a template? I just tried this, and instead of “refreshing” the dashboard, it navigates back to the original template.

Hi @carlos.fares, you will need to change the ‘navigate’ setting to ‘To a different view’ since template and dashboard are two different views. Then select the dashboard that you want to open from the ‘search files’ section. This is a simple script less method. You can also refresh individual elements on the dashboard using javascript method element.loadData() to reduce the load time.


Thank You,
Ankita Goyal Business System Analyst / Support Associate
Dundas BI

1 Like

Thanks, Ankita.
Hardcoding the target view will defeat the purpose of using a template. I think this should navigate to the dashboard using the template instead. I was able to set it to navigate to the embedding dashboard by overwriting the target object with a simple script.

this.clickActions[1].targetObjectId = dundas.context.baseViewViewService.currentView.id;