Dashboard - Passing Filter Values Using URL Parameters
Published 06-09-2022
Hi Anonymous ,
I'm trying to implement this solution so I can have preset filters via dashboard urls for ease of navigation through multiple dasboards.
It appears that certain filters in the url will not pass through to the dashboard, particularly if the filter has "Include all" already preselected and default set on the dashboard.
Upon further investigation, if the filter of interest has an option selected, then the url will pass through the filter.
Is there anyway to enable the filter via url to pass through regardless of the data currently filtered on or not?
try adding fil.jaql.filter.all = false
dashboard.on('initialized', function(widget) {
// Get Parameters
urlParameters = decodeURIComponent(window.location.href.substring(window.location.href.indexOf('?')+1)).split('&');
// Parse Parameters
parameters = new Map();
urlParameters.forEach(function(param) { parameters.set(param.split('=')[0],param.split('=')[1]) })
console.log(prism.activeDashboard.filters.$$items)
prism.activeDashboard.filters.$$items.forEach(function(fil) {
if (parameters.get(fil.jaql.title) !== undefined)
{
fil.jaql.filter.all = false
fil.jaql.filter.explicit = true
fil.jaql.filter.userMultiSelect = true
fil.jaql.filter.members = [parameters.get(fil.jaql.title)]
}
})
})