mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 736572 - Show arrow after sorting column in pageInfo. Provide empty string for comparison function if no according attribute was set. r=jaws
This commit is contained in:
parent
3c19cf9d3a
commit
fb373fe764
@ -98,11 +98,19 @@ pageInfoTreeView.prototype = {
|
|||||||
this,
|
this,
|
||||||
this.data,
|
this.data,
|
||||||
treecol.index,
|
treecol.index,
|
||||||
function textComparator(a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); },
|
function textComparator(a, b) { return (a || "").toLowerCase().localeCompare((b || "").toLowerCase()); },
|
||||||
this.sortcol,
|
this.sortcol,
|
||||||
this.sortdir
|
this.sortdir
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Array.forEach(tree.columns, function(col) {
|
||||||
|
col.element.removeAttribute("sortActive");
|
||||||
|
col.element.removeAttribute("sortDirection");
|
||||||
|
});
|
||||||
|
treecol.element.setAttribute("sortActive", "true");
|
||||||
|
treecol.element.setAttribute("sortDirection", this.sortdir ?
|
||||||
|
"ascending" : "descending");
|
||||||
|
|
||||||
this.sortcol = treecol.index;
|
this.sortcol = treecol.index;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -112,7 +120,7 @@ pageInfoTreeView.prototype = {
|
|||||||
isContainer: function(index) { return false; },
|
isContainer: function(index) { return false; },
|
||||||
isContainerOpen: function(index) { return false; },
|
isContainerOpen: function(index) { return false; },
|
||||||
isSeparator: function(index) { return false; },
|
isSeparator: function(index) { return false; },
|
||||||
isSorted: function() { },
|
isSorted: function() { return this.sortcol > -1 },
|
||||||
canDrop: function(index, orientation) { return false; },
|
canDrop: function(index, orientation) { return false; },
|
||||||
drop: function(row, orientation) { return false; },
|
drop: function(row, orientation) { return false; },
|
||||||
getParentIndex: function(index) { return 0; },
|
getParentIndex: function(index) { return 0; },
|
||||||
@ -187,10 +195,11 @@ gImageView.onPageMediaSort = function(columnname) {
|
|||||||
var treecol = tree.columns.getNamedColumn(columnname);
|
var treecol = tree.columns.getNamedColumn(columnname);
|
||||||
|
|
||||||
var comparator;
|
var comparator;
|
||||||
if (treecol.index == COL_IMAGE_SIZE || treecol.index == COL_IMAGE_COUNT) {
|
var index = treecol.index;
|
||||||
|
if (index == COL_IMAGE_SIZE || index == COL_IMAGE_COUNT) {
|
||||||
comparator = function numComparator(a, b) { return a - b; };
|
comparator = function numComparator(a, b) { return a - b; };
|
||||||
} else {
|
} else {
|
||||||
comparator = function textComparator(a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); };
|
comparator = function textComparator(a, b) { return (a || "").toLowerCase().localeCompare((b || "").toLowerCase()); };
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sortdir =
|
this.sortdir =
|
||||||
@ -198,13 +207,21 @@ gImageView.onPageMediaSort = function(columnname) {
|
|||||||
tree,
|
tree,
|
||||||
this,
|
this,
|
||||||
this.data,
|
this.data,
|
||||||
treecol.index,
|
index,
|
||||||
comparator,
|
comparator,
|
||||||
this.sortcol,
|
this.sortcol,
|
||||||
this.sortdir
|
this.sortdir
|
||||||
);
|
);
|
||||||
|
|
||||||
this.sortcol = treecol.index;
|
Array.forEach(tree.columns, function(col) {
|
||||||
|
col.element.removeAttribute("sortActive");
|
||||||
|
col.element.removeAttribute("sortDirection");
|
||||||
|
});
|
||||||
|
treecol.element.setAttribute("sortActive", "true");
|
||||||
|
treecol.element.setAttribute("sortDirection", this.sortdir ?
|
||||||
|
"ascending" : "descending");
|
||||||
|
|
||||||
|
this.sortcol = index;
|
||||||
};
|
};
|
||||||
|
|
||||||
var gImageHash = { };
|
var gImageHash = { };
|
||||||
|
Loading…
Reference in New Issue
Block a user