From fcc41bc535906ff11735ac415187642a774d598a Mon Sep 17 00:00:00 2001
From: Allan Jardine <allan.jardine@sprymedia.co.uk>
Date: Thu, 12 May 2011 20:18:48 +0100
Subject: [PATCH] Fix: When calculating the string width for column sizes, we
 know that we are going to be using strings for the display - so cast as a
 string, which means that we can take the length of any primitive
 (particularly numbers). Fix: The max string width calculation was including
 HTML, which is just plain wrong since the HTML will be hidden. This is still
 not perfect since "iiii" takes less space than "mmm" in the browser display,
 but addressing that would take some serious clocks cycles, and this is good
 enough for now.

---
 media/js/jquery.dataTables.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js
index 22f434f1..19b7cfd0 100644
--- a/media/js/jquery.dataTables.js
+++ b/media/js/jquery.dataTables.js
@@ -5685,8 +5685,9 @@
 			
 			for ( var i=0 ; i<oSettings.aoData.length ; i++ )
 			{
-				var s = _fnGetCellData( oSettings, i, iCol, 'display' );
-				if ( typeof s == 'string' && s.length > iMax )
+				var s = _fnGetCellData( oSettings, i, iCol, 'display' )+"";
+				s = s.replace( /<.*?>/g, "" );
+				if ( s.length > iMax )
 				{
 					iMax = s.length;
 					iMaxIndex = i;