Forum Discussion

zach_myt's avatar
zach_myt
Data Pipeline
03-13-2024
Solved

Hide Widget Using Web Access Token

We have an embedded dashboard that utilizes web access token for filtering on different organizations. We have a widget that only needs to be displayed to certain organizations. Does anyone know if w...
  • zach_myt's avatar
    04-24-2024

    I spoke with a Sisense developer and he stated this was not possible via WAT. Also since my prism is one user and group there isn't anything unique there. So the final options are:

    1) Create a pivot widget with data on what you want to filter on, organization name in my case, then if that widget contains the organization you want to hide the widget for then simply hide the widget using the .hide(). This does show the widget for a moment then remove it. It will also need to be on its own row since the dashboard will not redraw the widgets to account for the removed one.

     

    widget.on('ready', function(widget,result) {
     
       let orgs_with_location_codes = ["Org_1","Org_2"]
     
       let selected_org = $(`widget[widgetid="66293bbcaf582e003f18f101"`).find('.table-grid__content__inner').eq(1).text().trim();
     
    if(orgs_with_location_codes.indexOf(selected_org) == -1){
         $(`widget[widgetid="66293ac8af582e003f18f0d5"`).hide(); //widget to hide
         $(`widget[widgetid="66293bbcaf582e003f18f101"`).hide(); //pivot used to filter org
    }
     
    });

     

     
    2) Use a query parameter of hide widget = true in the dashboard URL then access the query parameter in the script to hide it like the above solution.
     
    3) Have 2 dashboards, one with the widget and one without then redirect accordingly.
     
    We will probably go with option 1 since it is the least code/admin heavy.