ankitvijay
02-18-2022Cloud Apps
Setting default filters through iframe query or disable "reset to default filter option"
Hi team.
We are loading the sisense dashboard through an iframe, and we are passing filters as query parameters in the iframe URL as mentioned here https://sisense.dev/guides/embedding/iframe.html#_5-appending-filters
We are looking to achieve either of the following:
- Disable (or hide) the `Restore my default filters" icon on the sisense dashboard when loaded through an iframe. I'm able to disable "set as a default option" as per this post https://community.sisense.com/t5/build-analytics/disable-dashboard-default-filter-settings/m-p/2017 by using the "Edit script" option in the sisense dashboard. Do we have a similar way to hide the highlighted icon?
- If it is not possible, can we read filters passed from the iframe query in "Edit script" and set those filters as default filter instead?
Hi harikm007,
Thanks for your response. This code worked. However, instead of selecting the button by title, I went for a slightly different approach by removing the siblings of the filter filter-title class. I also removed the "Restore" and "Add filter" icons explicitly, as I could see these icons flashed for a millisecond on load before getting removed. My overall code looks like below:
dashboard.on('initialized', function(se, ev){ se.userAuth.dashboards.filters.set_defaults = false; $('#general-restore-usage').remove(); $('#general-plus').remove(); }) dashboard.on('refreshstart', function(se, ev){ // Remove the restore button $('.filters-title').siblings().remove() })
Hope it can help others.