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 19, 2022
1 parent 83953c3 commit 17b5764
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 @@ -509,14 +509,6 @@ function EnhancedTableVisController ($scope, config) {

// 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 @@ -538,6 +530,14 @@ function EnhancedTableVisController ($scope, config) {
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 17b5764

Please sign in to comment.