0 Replies Latest reply on Jul 4, 2017 3:15 AM by Ritesh Gupta

    Tableau report show on button click

    Ritesh Gupta

      In my asp.net application I am trying to open a public tableau report on button click but same report gets loaded on Body load function. Here is my code. On body load:

      <body onload="initializeViz();">
        
      <form id="form1" runat="server">  
        
      <div id="vizContainer" style="width: 800px; height: 700px;">
        
      </div>
        
      </form>
      </body>

        function initializeViz
      () {

        debugger
        
      var placeholderDiv = document.getElementById("vizContainer");
        
      var url = "http://public.tableau.com/views/WorldIndicators/GDPpercapita";
        
      var options = {
        hideTabs
      : true,
        hideToolbar
      : true,
        onFirstInteractive
      : function () {
        workbook
      = viz.getWorkbook();
        activeSheet
      = workbook.getActiveSheet();
        
      }
        
      };
        viz
      = new tableau.Viz(placeholderDiv, url, options);
        
      }

      No I wish to load same report from function initializeViz on button click.

       

      <body>
        
      <form id="form1" runat="server">
        
      <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="functiongetdata()" />  
        
      <div id="vizContainer" style="width: 800px; height: 700px;">
        
      </div>
        
      </form>
        
      </body>
      <script type="text/javascript">
        function functiongetdata
      () {
        initializeViz
      ();
        
      }
        
      </script>