| Index: chrome/browser/resources/shared/js/cr/ui/array_data_model.js
|
| diff --git a/chrome/browser/resources/shared/js/cr/ui/array_data_model.js b/chrome/browser/resources/shared/js/cr/ui/array_data_model.js
|
| index c3f542b4e651055650a50902c2a287b0bc7150cb..b24d0213112a842f89200468ff05139221dacc7b 100644
|
| --- a/chrome/browser/resources/shared/js/cr/ui/array_data_model.js
|
| +++ b/chrome/browser/resources/shared/js/cr/ui/array_data_model.js
|
| @@ -148,20 +148,24 @@ cr.define('cr.ui', function() {
|
| spliceEvent.added = Array.prototype.slice.call(arguments, 2);
|
|
|
| var rv = arr.splice.apply(arr, arguments);
|
| + var self = this;
|
|
|
| // if sortStatus.field is null, this restores original order.
|
| - var sortPermutation = this.doSort_(this.sortStatus.field,
|
| - this.sortStatus.direction);
|
| - if (sortPermutation) {
|
| - var splicePermutation = deletePermutation.map(function(element) {
|
| - return element != -1 ? sortPermutation[element] : -1;
|
| - });
|
| - this.dispatchPermutedEvent_(splicePermutation);
|
| - } else {
|
| - this.dispatchPermutedEvent_(deletePermutation);
|
| - }
|
| + this.prepareSort(this.sortStatus.field, function() {
|
| + var sortPermutation = self.doSort_(self.sortStatus.field,
|
| + self.sortStatus.direction);
|
| + if (sortPermutation) {
|
| + var splicePermutation = deletePermutation.map(function(element) {
|
| + return element != -1 ? sortPermutation[element] : -1;
|
| + });
|
| + self.dispatchPermutedEvent_(splicePermutation);
|
| + } else {
|
| + self.dispatchPermutedEvent_(deletePermutation);
|
| + }
|
| +
|
| + self.dispatchEvent(spliceEvent);
|
| + });
|
|
|
| - this.dispatchEvent(spliceEvent);
|
| return rv;
|
| },
|
|
|
| @@ -197,10 +201,13 @@ cr.define('cr.ui', function() {
|
| this.dispatchEvent(e);
|
|
|
| if (this.sortStatus.field) {
|
| - var sortPermutation = this.doSort_(this.sortStatus.field,
|
| - this.sortStatus.direction);
|
| - if (sortPermutation)
|
| - this.dispatchPermutedEvent_(sortPermutation);
|
| + var self = this;
|
| + this.prepareSort(self.sortStatus.field, function() {
|
| + var sortPermutation = self.doSort_(self.sortStatus.field,
|
| + self.sortStatus.direction);
|
| + if (sortPermutation)
|
| + self.dispatchPermutedEvent_(sortPermutation);
|
| + });
|
| }
|
| },
|
|
|
|
|