2 Replies Latest reply on Sep 9, 2018 5:50 PM by Man Tsui

    JavaScript API question - multiple dashboards only when you have tabs?

    Gary Bisaga

      I have something happening that makes me think I don't really understand what's going on. I have this published workbook:

       

      https://public.tableau.com/profile/gary.bisaga#!/vizhome/B17001_5_year_poverty_age_***_0/Rankings

       

      As you can see, it's got four dashboards with tabs. I want to have a page that uses the JavaScript API to change dashboards based on UI Elements elsewhere on the page. I have a JavaScript onclick handler on the buttons, and use the button text to look up the dashboard name (i.e. button text is the same as the dashboard name). Here's how I'm changing dashboards:

       

            parent.addEventListener("click", function(event){

                let sheets = workbook.getPublishedSheetsInfo();

                let tab = titleCase(event.target.innerText);

                workbook.activateSheetAsync(tab);

            });

       

      This works great as long as I'm displaying the tabs. When I call getPublishedSheetsInfo(), it returns the four dashboards that are visible in the published workbook. It all works wonderful. You can see it work here: Dev Testing – Percent of Children Living Below Poverty in Vermont by Age & *** – Vermont Insights

       

      But then I make one change: I turn off the built-in tabs since they are no longer necessary or desirable. Namely, I go to the published workbook page:

       

      https://public.tableau.com/profile/gary.bisaga#!/vizhome/B17001_5_year_poverty_age_***_0/Rankings

       

      Then I click Edit Details and disable "Show workbook sheets as tabs." When I do this, however, now (1) Only the Rankings button works; the others cause activateSheetAsync to throw an exception "Sheet is not found in Workbook". (2) when it calls getPublishedSheetsInfo(), it only returns one dashboard, the Rankings dashboard. I made no other changes except turning off the tabs with the UI control.

       

      Is this expected behavior? Do I have to do something to force the other dashboards to be accessible?