From 0c493b67892c4d15f847bad4f7c8814a4f9d198a Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Thu, 12 May 2011 20:23:40 +0100 Subject: [PATCH] New: New column option - sContentPadding. What this option does is tag on an extra string to the content of the columns in the width calculation table, in order to take account of the fact that 'iii' is actually less wide than 'mm', but DataTables will pick 'iii' as the longer due to the string width. With sContentPadding you can add an extra string to any column to force DataTables to take account of this during the width calculation - the string in sContentPadding is not used anywhere else and is empty by default. This option will remain undocumented for the moment, since I suspect it will confuse more than help, but it is very useful to have around when x-scrolling. --- media/js/jquery.dataTables.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index 19b7cfd0..d6935efd 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -2540,6 +2540,7 @@ "fnSetData": null, "sSortDataType": 'std', "sDefaultContent": null, + "sContentPadding": "", "nTh": nTh ? nTh : document.createElement('th'), "nTf": null }; @@ -2609,6 +2610,7 @@ _fnMap( oCol, oOptions, "asSorting" ); _fnMap( oCol, oOptions, "sSortDataType" ); _fnMap( oCol, oOptions, "sDefaultContent" ); + _fnMap( oCol, oOptions, "sContentPadding" ); } /* Cache the data get and set functions for speed */ @@ -5560,6 +5562,10 @@ if ( nTd !== null ) { nTd = nTd.cloneNode(true); + if ( oSettings.aoColumns[i].sContentPadding !== "" ) + { + nTd.innerHTML += oSettings.aoColumns[i].sContentPadding; + } nTr.appendChild( nTd ); } }