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() { ...@@ -148,24 +148,20 @@ cr.define('cr.ui', function() {
spliceEvent.added = Array.prototype.slice.call(arguments, 2); spliceEvent.added = Array.prototype.slice.call(arguments, 2);
var rv = arr.splice.apply(arr, arguments); var rv = arr.splice.apply(arr, arguments);
var self = this;
// if sortStatus.field is null, this restores original order. // if sortStatus.field is null, this restores original order.
this.prepareSort(this.sortStatus.field, function() { var sortPermutation = this.doSort_(this.sortStatus.field,
var sortPermutation = self.doSort_(self.sortStatus.field, this.sortStatus.direction);
self.sortStatus.direction); if (sortPermutation) {
if (sortPermutation) { var splicePermutation = deletePermutation.map(function(element) {
var splicePermutation = deletePermutation.map(function(element) { return element != -1 ? sortPermutation[element] : -1;
return element != -1 ? sortPermutation[element] : -1; });
}); this.dispatchPermutedEvent_(splicePermutation);
self.dispatchPermutedEvent_(splicePermutation); } else {
} else { this.dispatchPermutedEvent_(deletePermutation);
self.dispatchPermutedEvent_(deletePermutation); }
}
self.dispatchEvent(spliceEvent);
});
this.dispatchEvent(spliceEvent);
return rv; return rv;
}, },
...@@ -201,13 +197,10 @@ cr.define('cr.ui', function() { ...@@ -201,13 +197,10 @@ cr.define('cr.ui', function() {
this.dispatchEvent(e); this.dispatchEvent(e);
if (this.sortStatus.field) { if (this.sortStatus.field) {
var self = this; var sortPermutation = this.doSort_(this.sortStatus.field,
this.prepareSort(self.sortStatus.field, function() { this.sortStatus.direction);
var sortPermutation = self.doSort_(self.sortStatus.field, if (sortPermutation)
self.sortStatus.direction); this.dispatchPermutedEvent_(sortPermutation);
if (sortPermutation)
self.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