From f175f3658e911f70bd3629e0b8613cce59b87ddc Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Fri, 16 Sep 2011 08:45:00 +0100 Subject: [PATCH] Fix: Calculating the width of a table can be incorrect when the calculation table is hidden due to an issue with jQuery's width/outerWidth calculation (http://bugs.jquery.com/ticket/9945). This is a bit of a work around to get the css value and check if it is a percentage - this is not perfect (since other relative values aren't checked - although they are generally unlikely to be used), but it is effective for most cases. --- media/js/jquery.dataTables.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index a295d170..25ba3327 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -1,6 +1,6 @@ /* * File: jquery.dataTables.js - * Version: 1.8.2 + * Version: 1.8.3.dev * Description: Paginate, search and sort HTML tables * Author: Allan Jardine (www.sprymedia.co.uk) * Created: 28/3/2008 @@ -67,7 +67,7 @@ * Notes: Allowed format is a.b.c.d.e where: * a:int, b:int, c:int, d:string(dev|beta), e:int. d and e are optional */ - _oExt.sVersion = "1.8.2"; + _oExt.sVersion = "1.8.3.dev"; /* * Variable: sErrMode @@ -5764,7 +5764,9 @@ } } - oSettings.nTable.style.width = _fnStringToCss( $(nCalcTmp).outerWidth() ); + var cssWidth = $(nCalcTmp).css('width'); + oSettings.nTable.style.width = (cssWidth.indexOf('%') !== -1) ? + cssWidth : _fnStringToCss( $(nCalcTmp).outerWidth() ); nCalcTmp.parentNode.removeChild( nCalcTmp ); } }