From 6c92221b501e324933d2408b80dff09830c818ed Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 6 Jul 2010 06:39:11 +0200 Subject: [PATCH] fixing column resize bug --- build/js/ox.js | 6 ++++-- build/js/ox.ui.js | 12 ++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/build/js/ox.js b/build/js/ox.js index de4ba30..6083ea1 100644 --- a/build/js/ox.js +++ b/build/js/ox.js @@ -1267,8 +1267,10 @@ Ox.formatValue = function(num, str) { >>> Ox.formatValue(123456789, "B") ??? */ - var val = ""; - $.each(["K", "M", "G", "T", "P"], function(i, v) { + var arr = ["K", "M", "G", "T", "P"], + len = arr.length, + val = ""; + $.each(arr, function(i, v) { if (num < Math.pow(1024, i + 2) || i == len - 1) { val = Ox.formatNumber(num / Math.pow(1024, i + 1), i) + " " + v + str; return false; diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index 4bccafe..49c4cf2 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -212,9 +212,11 @@ requires } return { bind: function(id, event, callback) { + Ox.print("a.l", arguments.length, id, event) if (arguments.length == 2) { callback = event; event = id; + Ox.print("e,c", event, callback) } if (isKeyboardEvent(event)) { keyboardEvents[id] = keyboardEvents[id] || {}; @@ -2617,6 +2619,7 @@ requires self.keyboardEvents["key_" + (self.options.orientation == "horizontal" ? "shift_right" : "shift_down")] = addNextToSelection; updateQuery(); + Ox.print("s.o", self.options) that.bindEvent(self.keyboardEvents); function addAllToSelection(pos) { @@ -3246,6 +3249,8 @@ requires // Body + Ox.print("s.vC", self.visibleColumns); + that.$body = new Ox.List({ construct: constructItem, id: self.options.id, @@ -3273,6 +3278,8 @@ requires width: getItemWidth() + "px" }); + Ox.print("s.vC", self.visibleColumns) + function addColumn(id) { } @@ -3385,6 +3392,7 @@ requires } function getItemWidth() { + return Ox.sum(self.columnWidths) return Math.max(Ox.sum(self.columnWidths), that.$element.width() - oxui.scrollbarSize); } @@ -3430,7 +3438,7 @@ requires that.$body.$content.css({ width: getItemWidth() + "px" // fixme: check if scrollbar visible, and listen to resize/toggle event }); - $(".OxColumn" + Ox.toTitleCase(self.options.columns[i].id)).css({ + $(".OxCell.OxColumn" + Ox.toTitleCase(self.options.columns[i].id)).css({ width: (width - 9) + "px" }); that.$body.clearCache(); @@ -4271,7 +4279,6 @@ requires ); function parseKeyboard(str) { - if (Ox.isObject(str)) return str; // fixme: this should not happen var modifiers = str.split(" "), key = modifiers.pop(); return { @@ -4444,6 +4451,7 @@ requires length = self.options.elements.length, dimensions = oxui.getDimensions(self.options.orientation), edges = oxui.getEdges(self.options.orientation); + Ox.print(self.options); $.each(self.options.elements, function(i, v) { var element = v.element .css({