diff --git a/packages/superset-ui-legacy-plugin-chart-pivot-table/src/PivotTable.js b/packages/superset-ui-legacy-plugin-chart-pivot-table/src/PivotTable.js index af0707e87..f2a445793 100644 --- a/packages/superset-ui-legacy-plugin-chart-pivot-table/src/PivotTable.js +++ b/packages/superset-ui-legacy-plugin-chart-pivot-table/src/PivotTable.js @@ -71,7 +71,7 @@ function PivotTable(element, props) { const metric = cols[i]; const format = columnFormats[metric] || numberFormat || '.3s'; const tdText = $(this)[0].textContent; - if (!Number.isNaN(tdText) && tdText !== '') { + if (!Number.isNaN(tdText) && tdText !== '' && tdText.trim().toLowerCase() !== 'null') { $(this)[0].textContent = formatNumber(format, tdText); $(this).attr('data-sort', tdText); } diff --git a/packages/superset-ui-plugins-demo/storybook/stories/legacy-plugin-chart-pivot-table/Stories.jsx b/packages/superset-ui-plugins-demo/storybook/stories/legacy-plugin-chart-pivot-table/Stories.jsx index 325e03aa7..b532bf54c 100644 --- a/packages/superset-ui-plugins-demo/storybook/stories/legacy-plugin-chart-pivot-table/Stories.jsx +++ b/packages/superset-ui-plugins-demo/storybook/stories/legacy-plugin-chart-pivot-table/Stories.jsx @@ -34,4 +34,34 @@ export default [ storyName: 'Basic', storyPath: 'legacy-|plugin-chart-pivot-table|PivotTableChartPlugin', }, + { + renderStory: () => ( + \n \n \n \n sum__num\n \n \n state\n other\n All\n \n \n name\n \n \n \n \n \n \n Christopher\n null\n 803607\n \n \n David\n null\n 673992\n \n \n James\n 749686\n null\n \n \n Jennifer\n 587540\n null\n \n \n John\n 638450\n 638450\n \n \n Joshua\n null\n 548044\n \n \n Matthew\n 608212\n 608212\n \n \n Michael\n 1047996\n 1047996\n \n \n Robert\n 575592\n 575592\n \n \n William\n 574464\n 574464\n \n \n All\n 6807583\n 6807583\n \n \n', + }, + }, + width: 400, + }} + /> + ), + storyName: 'With null', + storyPath: 'legacy-|plugin-chart-pivot-table|PivotTableChartPlugin', + }, ];