1 Reply Latest reply on Oct 19, 2017 8:53 AM by Sara Kelly

    STORY_POINT_SWITCH event never run

    Stefano Roncalli

      Hello, I'm having problem handling STORY_POINT_SWITCH event.

       

      I've a web page that instantiate viz object and load a story.

       

      I want to catch user interaction with Story Point navigation bar.

       

      This is the code I'm using:

       

      <script type="text/javascript" src="<my-tableau-server-url>/javascripts/api/tableau-2.min.js"></script>

      <div class="panel-body">

          <div id="tableauViz"></div>

      </div>

      <script>

          var viz, sheet, storypoints;

          function createViz(data) {

              var vizDiv = document.getElementById("tableauViz"),

              var options = {

                      hideTabs: true,

                      hideToolbar: true,

                      onFirstInteractive: function () {

                          var storyPointSwitchHandler = function (event) {

                              console.log('storyPointSwitchHandler : ', event);

                          };

                          viz.addEventListener(tableau.TableauEventName.STORY_POINT_SWITCH, storyPointSwitchHandler);

                      }

              };

              if (viz) {

                   viz.dispose();

              }

              var vizURL = '<my-view-trusted-url>';

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

          }

          function loadView() {

              $.ajax({

                      type: "GET",

                      url: "<url-that-give-me-a-token>",

                      data: <parameters-for-url-above>,

                      dataType: "json",

                      success: function (response) {

                          if (response.Status > 0) {

                              createViz(response);

                          }

                      }

               });

          }

          loadView();

      </script>

       

      View load correctly and I can navigate through the Story Points but the Event Listener not works at all

       

      Any help?

       

      Thank you in advance

      Stefano