2 Replies Latest reply on Apr 19, 2018 7:07 AM by Ryan Kitlinski

    Javascript API: Apply Filter on Non-Active Dashboard?

    Ryan Kitlinski

      Hi All,


      I have a workbook of dashboards that I am trying to filter using the JavaScript API. Of course, when the viz first loads, only one dashboard tab is active, and some of the filters I want to set are on the non-active sheets...


      My current solution for this issue is to call workbook.activateSheetAsync() on the dashboard I want to set filters for, but this has two undesirable side effects:


      1) It's slow - you have to wait for the dashboard to activate first, and then apply the filter to the sheet within the dashboard.

      2) Applying the last filter also has the undesirable consequence of leaving the last dashboard as the active one.


      So, it would be nice if i could set filters on non-active dashboards without activating them beforehand.


      According to the API documentation, there are two ways you can get an instance of a Sheet object - "from Workbook.getActiveSheet()or Dashboard.getObjects()."


      So then I looked at the Dashboard class reference and found this - "You get an instance of this from Workbook.getPublishedSheetsInfo()";


      In my testing, though, calling workbook.getPublishedSheetsInfo() returns  SheetInfo objects, not actual Sheet objects that you can work with. Examining the objects' function prototypes also shows no reference to getObjects().


      Am I missing something here, or can this not actually be done any other way?