2 Replies Latest reply on Jul 29, 2015 9:08 AM by Justin Rockwood

    Aysnc Filters

    Allan Turkington

      I’m having issues creating a custom filter page using js library (V8 and 2.0.0). 

       

      When a user clicks multiple different custom link that triggers multiple async filter.  Only the first request is processed.  I would like to somehow stop the first request or stack the requests.  Any thoughts?

        • 1. Re: Aysnc Filters
          Allan Turkington

          Found a solution, by modifying the Tableau iframe src.  This filter option should come standard to the Tableau-2.0.0 library.

           

          function filterIframe(filt) {

           

             var filterArgs;

           

           

           

             for (p in filt) {

           

              filterArgs += "&" + encodeURIComponent(p) + "=";

           

               if (typeof filt[p] === "string") {

           

           

           

                 filterArgs += encodeURIComponent(filt[p]);

           

           

           

           

           

               } else {

                 filterArgs += encodeURIComponent(filt[p].join(','));

           

               }

           

            }

           

           

            $('iframe').attr('src', baseIframeSrc_ + filterArgs);

           

           

          }

           

           

           

          1 of 1 people found this helpful
          • 2. Re: Aysnc Filters
            Justin Rockwood

            Allan's answer will work, but it has the effect of reloading the entire page within the iframe. Sometimes this is exactly what you want, but other times it can produce flashes on your page that you may want to avoid. Another way of doing what you want is to turn off automatic updates, then do all of your filtering, then turn it back on. This has the effect of queuing up the operations on the server-side and only re-rendering the viz once auto updates are turned back on. See the pauseAutomaticUpdatesAsync(), resumeAutomaticUpdatesAsync(), and toggleAutomaticUpdatesAsync() methods on the Viz class here.