1 Reply Latest reply on Nov 27, 2017 8:16 AM by lenaic.ridinger

    How catch property (column name) of the column clicked in the Viz.

    Erik Marke

      Hi all

       

       

      Below description of the problem we currently have with Tableau JS API.

       

       

      1.      I'm generating graph in the application using Tableau JS API and

      adding an event listener on the viz in following way:

       

      *public *initViz() {

        *let *containerDiv = document.getElementById('vizContainer');

        *let *options = {

          width: '100%',

          height: '100%',

          hideTabs: true,

          hideToolbar: true,

          onFirstInteractive: *function *() {

          }

        };

       

        *let *viz = *new *tableau.Viz(containerDiv, this.link, options);

        viz.addEventListener(tableau.TableauEventName.MARKS_SELECTION,

      *function *(mark)

      {

          mark.getMarksAsync().then(data => {

            console.log('Selected mark is:', data);

            *if *(data && data.length) {

              console.log('Selected mark\'s data:', data[0].getPairs());

            }

          });

        });

       

       

       

      2.      It properly generates a chart and embeds it into the application:

       

      • *

       

      3.      Now my goal is to click on a row and catch the event in the

      application with the data associated with the row (Domain IT, APM ID, APM

      Name etc…). Now I perform following sequence (steps 1,2,3,4). When I click

      on the first column values (steps 1,2) I receive empty event in my

      callback function. However when I click on the last column (steps 3,4) I

      receive all the row data I need.

       

       

       

      Questions:

       

      1.      How can we configure Tableau Viz, so that when clicking on the

      first column(steps 1,2) we receive the same dataset as we receive when

      clicking on the last column (steps 3,4).

       

      2.      Can we associate data with a row that is not visible in the table

      but that we see inside of event's object (hidden parameters)?

       

      3.      In general – what's the best way to handle scenario where we want

      to catch events from the Viz and use those events in JS application

      (possibly send some more complex data with the event (eg. Js object))

       

       

       

      Thanks for any support.

       

       

      Regards,

       

      Erik