diff --git a/superset/assets/javascripts/explorev2/stores/store.js b/superset/assets/javascripts/explorev2/stores/store.js index 817602d020..c74ac56156 100644 --- a/superset/assets/javascripts/explorev2/stores/store.js +++ b/superset/assets/javascripts/explorev2/stores/store.js @@ -264,7 +264,7 @@ export const visTypes = { ['table_timestamp_format'], ['row_limit'], ['page_length'], - ['include_search'], + ['include_search', 'table_filter'], ], }, ], @@ -1462,6 +1462,13 @@ export const fields = { description: 'Whether to include a client side search box', }, + table_filter: { + type: 'CheckboxField', + label: 'Table Filter', + default: false, + description: 'Whether to apply filter when table cell is clicked', + }, + show_bubbles: { type: 'CheckboxField', label: 'Show Bubbles', diff --git a/superset/assets/visualizations/table.js b/superset/assets/visualizations/table.js index 78f5af92bf..652723d5c7 100644 --- a/superset/assets/visualizations/table.js +++ b/superset/assets/visualizations/table.js @@ -106,7 +106,7 @@ function tableVis(slice) { return (d.isMetric) ? d.val : null; }) .on('click', function (d) { - if (!d.isMetric) { + if (!d.isMetric && fd.table_filter) { const td = d3.select(this); if (td.classed('filtered')) { slice.removeFilter(d.col, [d.val]); diff --git a/superset/forms.py b/superset/forms.py index b568957891..aa9ac038d0 100755 --- a/superset/forms.py +++ b/superset/forms.py @@ -784,6 +784,12 @@ class FormFactory(object): "description": _( "Whether to include a client side search box") }), + 'table_filter': (BetterBooleanField, { + "label": _("Table Filter"), + "default": False, + "description": _( + "Whether to apply filter when table cell is clicked") + }), 'show_bubbles': (BetterBooleanField, { "label": _("Show Bubbles"), "default": False, diff --git a/superset/viz.py b/superset/viz.py index d92620efdd..6f0a4ba1a9 100755 --- a/superset/viz.py +++ b/superset/viz.py @@ -421,7 +421,7 @@ class TableViz(BaseViz): 'table_timestamp_format', 'row_limit', 'page_length', - ('include_search', None), + ('include_search', 'table_filter'), ) }) form_overrides = ({