Skip to content

Commit

Permalink
[dashboard] re-enabling cascading filters
Browse files Browse the repository at this point in the history
#3183 disabled the
ability of a filterbox to get filtered by another filterbox
  • Loading branch information
mistercrunch committed Aug 18, 2017
1 parent 813ed60 commit c714ca9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,9 @@ How can i configure OAuth authentication and authorization?

You can take a look at this Flask-AppBuilder `configuration example
<https://github.com/dpgaspar/Flask-AppBuilder/blob/master/examples/oauth/config.py>`_.

How can I set a default filter on my dashboard?
-----------------------------------------------

Easy. Simply apply the filter and save the dashboard while the filter
is active.
8 changes: 4 additions & 4 deletions superset/assets/javascripts/dashboard/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,6 @@ export function dashboardContainer(dashboard, datasources, userid) {
}
},
effectiveExtraFilters(sliceId) {
// Don't filter the filter_box itself by preselect_filters
if (this.getSlice(sliceId).formData.viz_type === 'filter_box') {
return [];
}
const f = [];
const immuneSlices = this.metadata.filter_immune_slices || [];
if (sliceId && immuneSlices.includes(sliceId)) {
Expand All @@ -190,6 +186,10 @@ export function dashboardContainer(dashboard, datasources, userid) {
immuneToFields = this.metadata.filter_immune_slice_fields[sliceId];
}
for (const filteringSliceId in this.filters) {
if (filteringSliceId == sliceId) {
// Filters applied by the slice don't apply to itself
continue;
}
for (const field in this.filters[filteringSliceId]) {
if (!immuneToFields.includes(field)) {
f.push({
Expand Down

0 comments on commit c714ca9

Please sign in to comment.