From 73393925c0482007e498afa745be6d20d8c49b83 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Sat, 25 Feb 2017 17:19:58 -0800 Subject: [PATCH] [hotfix] Table view doesn't allow SELECT (no group by) (#2274) --- superset/assets/javascripts/explorev2/stores/visTypes.js | 6 ++++++ superset/assets/visualizations/table.js | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/superset/assets/javascripts/explorev2/stores/visTypes.js b/superset/assets/javascripts/explorev2/stores/visTypes.js index 4c3df7d0e7a9b..4b22c6922712c 100644 --- a/superset/assets/javascripts/explorev2/stores/visTypes.js +++ b/superset/assets/javascripts/explorev2/stores/visTypes.js @@ -254,6 +254,12 @@ const visTypes = { ], }, ], + controlOverrides: { + metrics: { + default: null, + validators: null, + }, + }, }, markup: { diff --git a/superset/assets/visualizations/table.js b/superset/assets/visualizations/table.js index 024f8a0ce2394..00dbd18e20254 100644 --- a/superset/assets/visualizations/table.js +++ b/superset/assets/visualizations/table.js @@ -19,9 +19,11 @@ function tableVis(slice, payload) { const fd = slice.formData; // Removing metrics (aggregates) that are strings const realMetrics = []; - for (const k in data.records[0]) { - if (fd.metrics.indexOf(k) > -1 && !isNaN(data.records[0][k])) { - realMetrics.push(k); + if (fd.metrics) { + for (const k in data.records[0]) { + if (fd.metrics.indexOf(k) > -1 && !isNaN(data.records[0][k])) { + realMetrics.push(k); + } } } const metrics = realMetrics;