mirror of
https://github.com/nasa/openmct.git
synced 2025-06-18 07:08:12 +00:00
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
This commit is contained in:
@ -80,14 +80,6 @@ define(
|
|||||||
$scope.$on('remove:row', this.removeRow.bind(this));
|
$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
|
* If auto-scroll is enabled, this function will scroll to the
|
||||||
* bottom of the page
|
* bottom of the page
|
||||||
@ -118,8 +110,7 @@ define(
|
|||||||
//Insert the row into the correct position in the array
|
//Insert the row into the correct position in the array
|
||||||
this.insertSorted(this.$scope.displayRows, row);
|
this.insertSorted(this.$scope.displayRows, row);
|
||||||
|
|
||||||
//Resize the columns , then update the rows
|
//Resize the columns , then update the rows visible in the table
|
||||||
// visible in the table
|
|
||||||
this.resize([this.$scope.sizingRow, row])
|
this.resize([this.$scope.sizingRow, row])
|
||||||
.then(this.setVisibleRows.bind(this))
|
.then(this.setVisibleRows.bind(this))
|
||||||
.then(this.scrollToBottom.bind(this));
|
.then(this.scrollToBottom.bind(this));
|
||||||
@ -460,17 +451,9 @@ define(
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
MCTTableController.prototype.resize = function (rows){
|
MCTTableController.prototype.resize = function (rows){
|
||||||
//Calculate largest row
|
|
||||||
var largestRow = this.buildLargestRow(rows);
|
|
||||||
|
|
||||||
// Has it changed? If so, set the the 'sizing' row which
|
this.$scope.sizingRow = this.buildLargestRow(rows);
|
||||||
// determines column widths
|
|
||||||
if (JSON.stringify(largestRow) !== JSON.stringify(this.$scope.sizingRow)){
|
|
||||||
this.$scope.sizingRow = largestRow;
|
|
||||||
return this.$timeout(this.setElementSizes.bind(this));
|
return this.$timeout(this.setElementSizes.bind(this));
|
||||||
} else {
|
|
||||||
return fastPromise(undefined);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user