more list

This commit is contained in:
Rolux 2010-06-29 18:28:22 +02:00
parent 4dc02f48dc
commit 57342999c4

View File

@ -2767,14 +2767,13 @@ requires
}) })
.html(v.title) .html(v.title)
.click(function() { .click(function() {
that.sort(v.id, self.options.sort[0].key == v.id ? clickColumn(v)
(self.options.sort[0].operator == "+" ? "-" : "+") : v.operator);
}) })
.appendTo(that.$head.$content.$element); .appendTo(that.$head.$content.$element);
$order = $("<div>") $order = $("<div>")
.addClass("OxOrder") .addClass("OxOrder")
.html(oxui.symbols["triangle_" + ( .html(oxui.symbols["triangle_" + (
self.options.sort[0].operator == "+" ? "up" : "down" v.operator == "+" ? "up" : "down"
)]) )])
.click(function() { .click(function() {
$(this).prev().trigger("click") $(this).prev().trigger("click")
@ -2847,6 +2846,13 @@ requires
} }
function clickColumn(data) {
var isSelected = self.options.sort[0].key == data.id;
that.sort(
data.id, isSelected ? (self.options.sort[0].operator == "+" ? "-" : "+") : data.operator
);
}
function constructItem(data, pos) { function constructItem(data, pos) {
var $item = $("<div>") var $item = $("<div>")
.addClass("OxItem") .addClass("OxItem")
@ -2911,9 +2917,9 @@ requires
} }
function toggleOrder(pos) { function toggleOrder(pos) {
self.options.columns[pos].operator = self.options.columns[pos].operator == "+" ? "-" : "+"; Ox.print("toggleOrder", pos, self.options.sort[0].operator)
that.$titles[pos].next().html(oxui.symbols[ that.$titles[pos].next().html(oxui.symbols[
"triangle" + self.options.columns[pos].operator == "+" ? "up" : "down" "triangle_" + (self.options.sort[0].operator == "+" ? "up" : "down")
]); ]);
} }
@ -2925,28 +2931,29 @@ requires
that.$titles[pos].toggleClass("OxSelected"); that.$titles[pos].toggleClass("OxSelected");
that.$titles[pos].next().toggleClass("OxSelected"); that.$titles[pos].next().toggleClass("OxSelected");
that.$titles[pos].next().next().children().eq(0).toggleClass("OxSelected"); that.$titles[pos].next().next().children().eq(0).toggleClass("OxSelected");
/*
that.$titles[pos].css({ that.$titles[pos].css({
width: ( width: (
that.$titles[pos].width() + pos == self.selectedColumn ? -16 : 16 that.$titles[pos].width() + (that.$titles[pos].hasClass("OxSelected") ? -16 : 16)
) + "px" ) + "px"
}); });
*/
} }
that.sort = function(key, operator) { that.sort = function(key, operator) {
if (key != self.options.sort.key || operator != self.options.sort.operator) { var isSelected = key == self.options.sort[0].key;
self.options.sort = [ self.options.sort = [
{ {
key: key, key: key,
operator: operator operator: operator
} }
]; ];
if (isSelected) {
toggleOrder(self.selectedColumn);
} else {
toggleSelected(self.selectedColumn); toggleSelected(self.selectedColumn);
self.selectedColumn = getColumnById(key); self.selectedColumn = getColumnById(key);
toggleSelected(self.selectedColumn); toggleSelected(self.selectedColumn);
that.$body.sort(self.options.sort[0].key, self.options.sort[0].operator);
} }
that.$body.sort(self.options.sort[0].key, self.options.sort[0].operator);
}; };
return that; return that;