From 51643f5db901d3febc159b49b518e1d03455e57b Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 2 Dec 2011 03:11:40 +0000 Subject: [PATCH] SOGoResizableTable: minor changes to fix some warnings with generated CSS. Monotone-Parent: 344542a59dbbe26fb20fcc06e0469e8e9fd3ce10 Monotone-Revision: 6e11f6220a9ec4ae00f4c090674fcb8b2910c44d Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2011-12-02T03:11:40 --- UI/WebServerResources/SOGoResizableTable.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/UI/WebServerResources/SOGoResizableTable.js b/UI/WebServerResources/SOGoResizableTable.js index 9bde09c52..c31316a77 100644 --- a/UI/WebServerResources/SOGoResizableTable.js +++ b/UI/WebServerResources/SOGoResizableTable.js @@ -36,6 +36,10 @@ var SOGoResizableTableInterface = { }, _resize: function() { + this.restore(); + }, + + restore: function(relativeWidths) { if (Prototype.Browser.IE) while (SOGoResizableTable._stylesheet.styleSheet.rules.length) SOGoResizableTable._stylesheet.styleSheet.removeRule(); @@ -43,8 +47,10 @@ var SOGoResizableTableInterface = { while (SOGoResizableTable._stylesheet.firstChild) SOGoResizableTable._stylesheet.removeChild(SOGoResizableTable._stylesheet.firstChild); + if (relativeWidths) + this.ratios = relativeWidths; var tableWidth = this.getWidth()/100; - var cells = $(this).down('tr').childElements(); + var cells = $(this).down('tr').select('.resizable'); for (i = 0; i < cells.length; i++) { var cell = cells[i]; var ratio = this.ratios.get(cell.id); @@ -52,17 +58,6 @@ var SOGoResizableTableInterface = { } }, - restore: function(relativeWidths) { - var tableWidth = this.getWidth()/100; - var cells = $(this).down('tr').childElements(); - for (i = 0; i < cells.length; i++) { - var cell = cells[i]; - var ratio = relativeWidths.get(cell.id); - SOGoResizableTable._resize(this, $(cell), i, null, ratio*tableWidth); - } - this.ratios = relativeWidths; - }, - computeColumnsWidths: function() { this.ratios = new Hash(); var tableWidth = 100/this.getWidth(); @@ -172,7 +167,7 @@ SOGoResizableTable = { } // Respect the minimum width of the cell. - w = Math.max(w - pad, parseInt(cell.getStyle('minWidth'))); + w = Math.max(Math.round(w) - pad, parseInt(cell.getStyle('minWidth'))); var delta = w - cell.getWidth() + pad;