diff --git a/src/js/core/directives/ui-grid.js b/src/js/core/directives/ui-grid.js index 4e91f234b7..63ed0236a2 100644 --- a/src/js/core/directives/ui-grid.js +++ b/src/js/core/directives/ui-grid.js @@ -78,6 +78,8 @@ } } + var mostRecentData; + function dataWatchFunction(newData) { // gridUtil.logDebug('dataWatch fired'); var promises = []; @@ -90,6 +92,8 @@ } } + mostRecentData = newData; + if (newData) { // columns length is greater than the number of row header columns, which don't count because they're created automatically var hasColumns = self.grid.columns.length > (self.grid.rowHeaderColumns ? self.grid.rowHeaderColumns.length : 0); @@ -118,7 +122,8 @@ } $q.all(promises).then(function() { - self.grid.modifyRows(newData) + // use most recent data, rather than the potentially outdated data passed into watcher handler + self.grid.modifyRows(mostRecentData) .then(function () { // if (self.viewport) { self.grid.redrawInPlace(true);