fixing column resize bug

This commit is contained in:
rolux 2010-07-06 06:39:11 +02:00
parent dcd80f7268
commit 6c92221b50
2 changed files with 14 additions and 4 deletions

View File

@ -1267,8 +1267,10 @@ Ox.formatValue = function(num, str) {
>>> Ox.formatValue(123456789, "B") >>> Ox.formatValue(123456789, "B")
??? ???
*/ */
var val = ""; var arr = ["K", "M", "G", "T", "P"],
$.each(["K", "M", "G", "T", "P"], function(i, v) { len = arr.length,
val = "";
$.each(arr, function(i, v) {
if (num < Math.pow(1024, i + 2) || i == len - 1) { if (num < Math.pow(1024, i + 2) || i == len - 1) {
val = Ox.formatNumber(num / Math.pow(1024, i + 1), i) + " " + v + str; val = Ox.formatNumber(num / Math.pow(1024, i + 1), i) + " " + v + str;
return false; return false;

View File

@ -212,9 +212,11 @@ requires
} }
return { return {
bind: function(id, event, callback) { bind: function(id, event, callback) {
Ox.print("a.l", arguments.length, id, event)
if (arguments.length == 2) { if (arguments.length == 2) {
callback = event; callback = event;
event = id; event = id;
Ox.print("e,c", event, callback)
} }
if (isKeyboardEvent(event)) { if (isKeyboardEvent(event)) {
keyboardEvents[id] = keyboardEvents[id] || {}; keyboardEvents[id] = keyboardEvents[id] || {};
@ -2617,6 +2619,7 @@ requires
self.keyboardEvents["key_" + (self.options.orientation == "horizontal" ? "shift_right" : "shift_down")] = addNextToSelection; self.keyboardEvents["key_" + (self.options.orientation == "horizontal" ? "shift_right" : "shift_down")] = addNextToSelection;
updateQuery(); updateQuery();
Ox.print("s.o", self.options)
that.bindEvent(self.keyboardEvents); that.bindEvent(self.keyboardEvents);
function addAllToSelection(pos) { function addAllToSelection(pos) {
@ -3246,6 +3249,8 @@ requires
// Body // Body
Ox.print("s.vC", self.visibleColumns);
that.$body = new Ox.List({ that.$body = new Ox.List({
construct: constructItem, construct: constructItem,
id: self.options.id, id: self.options.id,
@ -3273,6 +3278,8 @@ requires
width: getItemWidth() + "px" width: getItemWidth() + "px"
}); });
Ox.print("s.vC", self.visibleColumns)
function addColumn(id) { function addColumn(id) {
} }
@ -3385,6 +3392,7 @@ requires
} }
function getItemWidth() { function getItemWidth() {
return Ox.sum(self.columnWidths)
return Math.max(Ox.sum(self.columnWidths), that.$element.width() - oxui.scrollbarSize); return Math.max(Ox.sum(self.columnWidths), that.$element.width() - oxui.scrollbarSize);
} }
@ -3430,7 +3438,7 @@ requires
that.$body.$content.css({ that.$body.$content.css({
width: getItemWidth() + "px" // fixme: check if scrollbar visible, and listen to resize/toggle event 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" width: (width - 9) + "px"
}); });
that.$body.clearCache(); that.$body.clearCache();
@ -4271,7 +4279,6 @@ requires
); );
function parseKeyboard(str) { function parseKeyboard(str) {
if (Ox.isObject(str)) return str; // fixme: this should not happen
var modifiers = str.split(" "), var modifiers = str.split(" "),
key = modifiers.pop(); key = modifiers.pop();
return { return {
@ -4444,6 +4451,7 @@ requires
length = self.options.elements.length, length = self.options.elements.length,
dimensions = oxui.getDimensions(self.options.orientation), dimensions = oxui.getDimensions(self.options.orientation),
edges = oxui.getEdges(self.options.orientation); edges = oxui.getEdges(self.options.orientation);
Ox.print(self.options);
$.each(self.options.elements, function(i, v) { $.each(self.options.elements, function(i, v) {
var element = v.element var element = v.element
.css({ .css({