Renderer: Ellipsis plug-in was overwriting any pre-exisiting renderers!

pull/236/head
Allan Jardine 9 years ago
parent 57a3d80321
commit d51fc04b42

@ -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 '<span class="ellipsis" title="'+d+'">'+str+'&#8230;</span>';
if ( wordbreak ) {
// Find the last white space character in the string
str = str.replace(/\s([^\s]*)$/, '');
}
};
}
return '<span class="ellipsis" title="'+d+'">'+str+'&#8230;</span>';
}
};
};
Loading…
Cancel
Save