From f34e8ba61b1acdcbe21edbf8bef5dba523ac91db Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 11 Apr 2016 13:09:02 -0700 Subject: [PATCH] Modified code to call resize on every row add. Removed optimization to only resize when needed, because in fact resuze is necessary on every update in order to set vertical scroll size --- .../src/controllers/MCTTableController.js | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/platform/features/table/src/controllers/MCTTableController.js b/platform/features/table/src/controllers/MCTTableController.js index a90d660f3c..9b65613516 100644 --- a/platform/features/table/src/controllers/MCTTableController.js +++ b/platform/features/table/src/controllers/MCTTableController.js @@ -80,14 +80,6 @@ define( $scope.$on('remove:row', this.removeRow.bind(this)); } - function fastPromise(returnValue) { - return { - then: function (callback) { - return fastPromise(callback(returnValue)); - } - }; - } - /** * If auto-scroll is enabled, this function will scroll to the * bottom of the page @@ -118,8 +110,7 @@ define( //Insert the row into the correct position in the array this.insertSorted(this.$scope.displayRows, row); - //Resize the columns , then update the rows - // visible in the table + //Resize the columns , then update the rows visible in the table this.resize([this.$scope.sizingRow, row]) .then(this.setVisibleRows.bind(this)) .then(this.scrollToBottom.bind(this)); @@ -460,17 +451,9 @@ define( * @private */ MCTTableController.prototype.resize = function (rows){ - //Calculate largest row - var largestRow = this.buildLargestRow(rows); - // Has it changed? If so, set the the 'sizing' row which - // determines column widths - if (JSON.stringify(largestRow) !== JSON.stringify(this.$scope.sizingRow)){ - this.$scope.sizingRow = largestRow; - return this.$timeout(this.setElementSizes.bind(this)); - } else { - return fastPromise(undefined); - } + this.$scope.sizingRow = this.buildLargestRow(rows); + return this.$timeout(this.setElementSizes.bind(this)); }; /**