Commit 622e46b9 authored by jar@chromium.org's avatar jar@chromium.org

Revert 98901 - Call prepareSort before any sorting happens.

The file manager code depends on the prepareSort method to fetch required sort fields from the filesystem before a sort happens, but the ArrayDataModel doesn't always call it.  This makes for unsorted file lists in certain situations.

BUG=chromium-os:19834
TEST=manual testing


Review URL: http://codereview.chromium.org/7799034

TBR=rginda@chromium.org
Review URL: http://codereview.chromium.org/7812018

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98913 0039d316-1c4b-4281-b951-d872f2087c98
parent 3e47014f
......@@ -148,24 +148,20 @@ 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.
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);
});
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.dispatchEvent(spliceEvent);
return rv;
},
......@@ -201,13 +197,10 @@ cr.define('cr.ui', function() {
this.dispatchEvent(e);
if (this.sortStatus.field) {
var self = this;
this.prepareSort(self.sortStatus.field, function() {
var sortPermutation = self.doSort_(self.sortStatus.field,
self.sortStatus.direction);
if (sortPermutation)
self.dispatchPermutedEvent_(sortPermutation);
});
var sortPermutation = this.doSort_(this.sortStatus.field,
this.sortStatus.direction);
if (sortPermutation)
this.dispatchPermutedEvent_(sortPermutation);
}
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment