cancel
Showing results for 
Search instead for 
Did you mean: 

Setting default filters through iframe query or disable "reset to default filter option"

ankitvijay
8 - Cloud Apps
8 - Cloud Apps

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:

ankitvijay_0-1645172753649.png

 

  • 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? 

 

1 ACCEPTED SOLUTION

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.

View solution in original post

4 REPLIES 4

harikm007
13 - Data Warehouse
13 - Data Warehouse

@ankitvijay ,

This dashboard script will hide 'Restore my default filters' icon. I tested it in Sisense dashboard. Please check if it works in your iFrame as well.

dashboard.on('initialized', function(se, ev){
	$('#prism-rightview .global-filters .filters-headline .fl-icon-container').remove()
})

-Hari

 

HI @harikm007 ,

Thanks for your response.

I tried to use the above code. But unfortunately, it does not seem to be working. If it helps here is the reset filter button element I see.

<button class="btn btn--icon btn--dark btn--on-grey enabled" title="Restore my default filters " data-ng-click="resetFilters()" data-ng-show="dashboard.defaultFilters" data-ng-disabled="!isFilterDifferentFromDefault()" data-ng-class="{'enabled': isFilterDifferentFromDefault()}"> <svg class="svg-i"> <use xlink:href="#general-restore-usage"></use> </svg> </button>

I was able to hide the icon using the below code but the invisible button is still there. Is there a better way to identify and remove the button?

$('#general-restore-usage').remove();

 

harikm007
13 - Data Warehouse
13 - Data Warehouse

@ankitvijay ,

Not sure why HTML classes are different in my view. But please try this script (this is based on the html you posted above)

 

dashboard.on('refreshstart', function(se, ev){
	$('button[title="Restore my default filters "]').remove()
})

 

-Hari

 

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.