0 Replies Latest reply on Dec 3, 2015 6:44 AM by Sidi Peter

    Switching/passing in the var vizURL per view

    Sidi Peter

      Hi,

      Building a html menu page accessing Viz(s) using the standard javascript calling up workbook/url link.

      When an item on the menu is clicked a viz is called using the code below javascript code below and the html click code:

       

      My question is how to call a viz in different workbook/url in the menu.

      It seems that:

      • all the vizs need to be one workbook

           or

      • each menu item needs javascript file to call a viz

       

      Is there better way of changing/inserting the URL value similar to the switchView?

       

      Thanks in advance for your help.

       

      Peter

       

       

       

      html click:


        <a  style="text-align:left"; class="hover"; onClick="switchView('DB: YoY Case Ct by Service')">Year over Year Utilization</a>

       

      menu.png

      javascript code:

      var viz, workbook, activeSheet ;

      // Initialize the javascript controls for Tableau

      window.onload=function() {

          var vizDiv = document.getElementById('viz');                

          var vizURL =  'https://tableau.mskcc.org/t/ClinicalSystemsDecisionSupport/views/PerioperativePortalM6_0/ORSummaryPage';

          var options = {

              width:  '1280px',

              height: '1024px',

              hideToolbar: true,

              hideTabs: true,

              onFirstInteractive: function() {

                  document.getElementById('sheetName').innerHTML=viz.getWorkbook().getActiveSheet().getName();

              }

          }

          viz = new tableauSoftware.Viz(vizDiv,vizURL, options);

      };

      // Change the displayed view in the workbook

      function switchView(sheetName)

      {

          workbook = viz.getWorkbook();

          workbook.activateSheetAsync(sheetName);

      };