1 Reply Latest reply on Apr 27, 2016 10:01 PM by Tharashasank Davuluru

    Temporarily disabling Tableau JavaScript's MARKS_SELECTION event listener

    Dinesh Kumar S R

      I'm working on a JavaScript framework that integrates Tableau worksheets using Tableau's JavaScript API such that a selection in one sheet is applied to all others.  The sheets are dynamic thus this is my preferred solution.


      I need to disable the marks event listener so that my marks automation doesn't cause it to infinitely trigger.  It appears to me this should be done in the then() promise (shown below in bold) but unfortunately, the marks event is still triggered infinitely and want to stop that.


      As expected, removing addEventListener() in the then() promise stops the event from infinitely triggering -- but, of course, it only works once then.


      Here is the paired down code... it may not be perfect since I removed some extra code, but it demonstrates the pattern I'm attempting:


      Analytic.prototype.applyMarks = function (marks) {

          // remove marks selection listener to prevent selectMarksAsync from triggering it

          this.viz.removeEventListener(tableauSoftware.TableauEventName.MARKS_SELECTION, this.marksSelectionFunc);

           // set marks programmatically

          worksheet.selectMarksAsync(marks, tableauSoftware.SelectionUpdateType.REPLACE).then(

           // re-establish marks selection listener

                    $.proxy(this.viz.addEventListener(tableauSoftware.TableauEventName.MARKS_SELECTION, this.marksSelectionFunc), this);






      Can anyone help me to avoide infinitely triggers so that this will help us to access the dashboard faster and diplamatic.



      Best Wishes,