Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2474)

Unified Diff: chrome/browser/resources/shared/js/cr/ui/array_data_model.js

Issue 7799034: Call prepareSort before any sorting happens. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ });
}
},
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698