From d51fc04b42f88c2761f055518935a54e927e2304 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Fri, 18 Dec 2015 12:15:13 +0000 Subject: [PATCH] Renderer: Ellipsis plug-in was overwriting any pre-exisiting renderers! --- dataRender/ellipsis.js | 44 ++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/dataRender/ellipsis.js b/dataRender/ellipsis.js index 721c788..117b834 100644 --- a/dataRender/ellipsis.js +++ b/dataRender/ellipsis.js @@ -45,33 +45,31 @@ * } ); */ -jQuery.fn.dataTable.render = { - ellipsis: function ( cutoff, wordbreak ) { - return { - display: function ( d ) { - if ( wordbreak === undefined ) { - wordbreak = false; - } - - if ( typeof d !== 'number' && typeof d !== 'string' ) { - return d; - } +jQuery.fn.dataTable.render.ellipsis = function ( cutoff, wordbreak ) { + return { + display: function ( d ) { + if ( wordbreak === undefined ) { + wordbreak = false; + } - var str = d.toString(); // cast numbers + if ( typeof d !== 'number' && typeof d !== 'string' ) { + return d; + } - if ( d.length < cutoff ) { - return d; - } + var str = d.toString(); // cast numbers - str = d.substr(0, cutoff); + if ( d.length < cutoff ) { + return d; + } - if ( wordbreak ) { - // Find the last white space character in the string - str = str.replace(/\s([^\s]*)$/, ''); - } + str = d.substr(0, cutoff); - return ''+str+'…'; + if ( wordbreak ) { + // Find the last white space character in the string + str = str.replace(/\s([^\s]*)$/, ''); } - }; - } + + return ''+str+'…'; + } + }; }; \ No newline at end of file