subCanvasViewContainer

I would like to create a drop-down list that would change the related dashboard contained within the subCanvasViewContainer. Anyone know how to code this script?

example
var metricSetId = dropDownList2.value;

if (metricSetID==“Financial”)
subCanvasViewContainer1 changed to show the financial dashboard
else show the operations dashboard

Hi Dale,

To change the content of the subCanvasViewContainer just do something like the following:

var dashboardId = "61bfd662-ffba-42b6-bc57-1d9993d5ae43";

// Needed otherwise the SubCanvasViewContainer, fails to load.
dashboardId = dashboardId.toLowerCase();  

viewContainer1.setTarget(dashboardId, dundas.entities.ViewType.DASHBOARD);

Pay attention to the comment in the code, you MUST pass the id using lowercase (last time i checked). If you don’t you’ll find it won’t navigate successfully.

1 Like

thanks, Jeff. worked perfectly.

great!!! have a great weekend.

Hi Jeff,

What if the different dashboards I want to show in the view container receive different parameters and I have to pass them according?

Thanks.

Hi Fabiano - good to hear from you.

When you use the view container, you can hook parameters up to it just like you would if the visualization was sitting right on the dashboard. The problem is, if you are going to change the target of the view parameter than you are going to have to programmatically hook up parameters to the new objects as the view container content changes. It’s certainly possible to do this but you’re going to have to be happy scripting and maintaining the code. Ask yourself if you really need things to be this dynamic as you can save a bit of time with some hard-coded layers.

Here is a quick sample that will show you how to hook up an existing parameter if you want to go this direction.

              var linkParent = new dundas.view.ElementParameterLink();          	          	
              linkParent.adapterId = myAdapterId;
              linkParent.parameterId = newViewParameter.id;
              existingViewParameter.addElementParameterLink(linkParent);
              existingViewParameter.refreshAllAdapters();

The debugger; command is going to be your friend here as you can inspect what these properties look like when you set them with the UI. Just replicate what the Dundas BI application is doing to bind these parameters and you should be good.

1 Like

Thanks Jeff, I’ll have a go on this.

I know it’s a bit too dynamic but to give you a bit of background, the idea is to have a series of small dashboards, like informational cards, and have 5 fixed view containers in the main dashboard. So each user can configure which informational cards he/she wants to see in the main dashboard and which order they will be displayed. This last part is actually a table in the database I read when loading the dashboard.

Thanks for the tip.

Something like this?

https://microsite.dundas.com/api/resource/staticresource/redirect.html?dashboard=61bfd662-ffba-42b6-bc57-1d9993d5ae43

1 Like

ok, that is amazing. could you share the code?

I can email you the project if you’re keen to reverse engineer it. This might make a good video for our Off the Charts program as a walk through would probably be helpful to understand what’s going on. Are you looking for something in the short term or can you wait a bit? I’d be happy to make a video giving the code and walking through the concept in a few weeks.

i can certainly wait. it will be worth the wait. thanks Jeff!

my pleasure! @dale.dean

Yes, something like that but with parameters in the main dashboard, like period, business unit, etc.

Would be very helpful if you can do that for the Off the Charts. Can you let me know when it’s on?

Thanks,
Fab.

Hi @fabiano, @dale.dean,

As promised, here is the how-to for this self-service dashboard. We’ve posted it to YouTube and it will appear on the Off the Chart site tomorrow with the code.

Hope you like it!
-jeff

Hi Jeff,

Can this be used to refresh the contents of a subCanvasViewContainer if you were to navigate to the same dashboard id? Or is there a simpler way of this?

Hi Shane,

There are two ways I can think to approach this right now.

  1. Like you said, navigate to the same id from outside of the subCanvas
  2. You might also consider adding a refresh button to the individual mini-dashboards which call a navigate interaction to themselves. Maybe just a small icon like this in the corner?

image

The cool thing about this approach is that it would be completely codeless.