Skip to content
Snippets Groups Projects
Commit 3a59d9f8 authored by Allen Gilliland's avatar Allen Gilliland
Browse files

Merge pull request #2285 from metabase/fix-pivot-formatting

Fix pivot table formatting
parents 89b92e6e c550acb4
No related branches found
No related tags found
No related merge requests found
import _ from "underscore";
import * as SchemaMetadata from "metabase/lib/schema_metadata";
import { formatValue } from "metabase/lib/formatting";
function compareNumbers(a, b) {
return a - b;
......@@ -37,6 +38,7 @@ var DataGrid = {
// TODO: we assume dimensions are in the first 2 columns, which is less than ideal
var pivotCol = 0,
normalCol = 1,
cellCol = 2,
pivotColValues = DataGrid.distinctValues(data, pivotCol),
normalColValues = DataGrid.distinctValues(data, normalCol);
if (normalColValues.length <= pivotColValues.length) {
......@@ -89,9 +91,8 @@ var DataGrid = {
return data.cols[normalCol];
}
var colDef = _.clone(data.cols[pivotCol]);
colDef['display_name'] = val || "";
colDef['name'] = val || "";
var colDef = _.clone(data.cols[cellCol]);
colDef['name'] = colDef['display_name'] = formatValue(val, { column: data.cols[pivotCol] });
return colDef;
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment