fix for column resize after column add/remove

This commit is contained in:
rolux 2010-09-05 23:17:16 +02:00
parent 9241b3e66c
commit a9d70eb348

View file

@ -6529,6 +6529,7 @@ requires
}); });
column.visible = true; column.visible = true;
self.visibleColumns.splice(index, 0, column); self.visibleColumns.splice(index, 0, column);
self.columnWidths.splice(index, 0, column.width);
that.$head.$content.empty(); that.$head.$content.empty();
constructHead(); constructHead();
that.$body.options({ that.$body.options({
@ -6770,6 +6771,7 @@ requires
Ox.print('removeColumn', id); Ox.print('removeColumn', id);
var className = '.OxColumn' + Ox.toTitleCase(id), var className = '.OxColumn' + Ox.toTitleCase(id),
index = getColumnIndexById(id), index = getColumnIndexById(id),
itemWidth,
position = getColumnPositionById(id), position = getColumnPositionById(id),
$column = $('.OxTitle' + className), $column = $('.OxTitle' + className),
$order = $column.next(), $order = $column.next(),
@ -6777,10 +6779,9 @@ requires
self.options.columns[index].visible = false; self.options.columns[index].visible = false;
self.visibleColumns.splice(position, 1); self.visibleColumns.splice(position, 1);
self.columnWidths.splice(position, 1); self.columnWidths.splice(position, 1);
that.$head.$content.empty();
constructHead();
itemWidth = getItemWidth(); itemWidth = getItemWidth();
$column.remove();
$order.remove();
$resize.remove();
$.each(that.$body.find('.OxItem'), function(i, v) { $.each(that.$body.find('.OxItem'), function(i, v) {
var $v = $(v); var $v = $(v);
$v.children(className).remove(); $v.children(className).remove();
@ -6805,6 +6806,7 @@ requires
function resizeColumn(id, width) { function resizeColumn(id, width) {
var i = getColumnIndexById(id), var i = getColumnIndexById(id),
pos = getColumnPositionById(id); pos = getColumnPositionById(id);
self.visibleColumns[pos].width = width;
self.columnWidths[pos] = width; self.columnWidths[pos] = width;
that.$head.$content.css({ that.$head.$content.css({
width: (Ox.sum(self.columnWidths) + 2) + 'px' width: (Ox.sum(self.columnWidths) + 2) + 'px'