Use a radio button list to show/hide metric sets in a subcanvas view container

Hello,

I have a main dashboard with 3 subcanvas view containers. In each subcanvas container is a different dashboard with multiple metric sets. I have a radio button list on the main dashboard with 2 selection options. When the selection is changed in the radio button list, I would like to toggle what metric sets are being displayed in each subcanvas view.

I will admit my Javascripting skills are very basic, so I may not even be close on coming up with a solution, but below is the logic I have been playing around with…

if(radioButtonList1.items[0].isChecked == true)
{
subCanvasViewContainer1.getContainedAdapters(“23b3ccab-90e5-414f-9961-cd2b51f0ef13”).hidden = false;
};

if(radioButtonList1.items[1].isChecked == true)
{
subCanvasViewContainer1.getContainedAdapters(“23b3ccab-90e5-414f-9961-cd2b51f0ef13”).hidden = true;
};

23b3ccab-90e5-414f-9961-cd2b51f0ef13 is the id of one of the metric sets within the dashboard on subCanvasViewContainer1

Any help you can provide would be appreciated.
Thanks,
Chuck

It might be easier to use layers instead of sub canvas views.
but if these other dashboards with multiple metric sets are used else where then I can see the point in having then as stand alone dashboards, if not I would go with layers instead.

Thanks for the reply James. The reason we are using subcanvas views instead of layers is so that we can have more than one developer working on the project at the same time. Someone works on dashboard 1 and another person works on dashboard 2, when finished we combine them on a main dashboard using the subcanvas views.

I reached out to support on this issue and they provided me the below logic. I figured I’d share it here in case anyone else can use it…

In order to achieve the use case described, you would have to write a script performing the algorithm of capturing the dashboard and save its all adapters in an array. Then from that array, capture the metric sets you want to toggle(hide/show). Check out the sample script below:

//capturing the dashboards in subcanvas
var dash1 = subCanvasViewContainer1.getContainedAdapters();
var dash2 = subCanvasViewContainer2.getContainedAdapters();

//get all the metric sets from the subcanvas dashboards
var dash1_tables = dash1[0].getAdapters();
var dash2_tables = dash2[0].getAdapters();

//hiding metric sets within subcanvas
if(radioButtonList1.items[0].isChecked == true)
{
dash1_tables[0].hidden = true;
dash1_tables[1].hidden = false;
};

if(radioButtonList1.items[1].isChecked == true)
{
dash1_tables[0].hidden = false;
dash1_tables[1].hidden = true;
};