Skip to content

Commit

Permalink
fix col() function used with customColPosition (issue #243)
Browse files Browse the repository at this point in the history
  • Loading branch information
fbaligand committed Feb 20, 2022
1 parent a54a382 commit f24e0dd
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions public/enhanced-table-vis-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,14 +545,6 @@ module.controller('EnhancedTableVisController', function ($scope, Private, confi

// add new computed column
newColumn = _.clone(newColumn);
if (customColumnPosition || customColumnPosition === 0) {
table.columns.splice(customColumnPosition, 0, newColumn);
}
else {
table.columns.push(newColumn);
}

// add "total" formatter function
if (!computedColsPerSplitCol) {
newColumn.totalFormatter = createTotalFormatter(table, newColumn, undefined, totalHits, timeRange, computedColsPerSplitCol, splitColIndex);
}
Expand All @@ -574,6 +566,14 @@ module.controller('EnhancedTableVisController', function ($scope, Private, confi
newColumn.total = computeFormulaValue(newColumn.totalFormula, table, null, totalHits, timeRange);
}

// insert new column in table
if (customColumnPosition || customColumnPosition === 0) {
table.columns.splice(customColumnPosition, 0, newColumn);
}
else {
table.columns.push(newColumn);
}

};

const processLinesComputedFilter = function (tables, linesComputedFilterFormula, totalHits, timeRange) {
Expand Down

0 comments on commit f24e0dd

Please sign in to comment.