Truncate column content via jTruncate (JSON)
Truncate column content via jTruncate (JSON)
andi_sf
Posts: 7Questions: 0Answers: 0
I have set up in my JSON data source a class wrapped around text.
I now like to truncate this text via jTruncate (http://www.jeremymartin.name/projects.php?project=jTruncate).
I have accomplish that with:
[code] "fnInitComplete": function(oSettings, json) {
$('.doc-desc').jTruncate();
} [/code]
but this works only on the initially loaded first results page - on subsequent paginated results the text is not truncated any more. Any help would be greatly appreciated... thanks in advance!
I now like to truncate this text via jTruncate (http://www.jeremymartin.name/projects.php?project=jTruncate).
I have accomplish that with:
[code] "fnInitComplete": function(oSettings, json) {
$('.doc-desc').jTruncate();
} [/code]
but this works only on the initially loaded first results page - on subsequent paginated results the text is not truncated any more. Any help would be greatly appreciated... thanks in advance!
This discussion has been closed.
Replies
[code]
"fnInitComplete": function(oSettings, json) {
this.$('.doc-desc').jTruncate();
}
[/code]
*edit* - this is why: http://datatables.net/faqs#events
Allan
thank you so much - this worked like a charm -you are a life saver!
I tested this, it works for the first json page (sAjaxSource). But the next page will be as "usual".
Is there a solution for server-side display of data?
yours
Alexander
Sorry I did not try enough before posting, here is my solution for server-side display:
[code]
"fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) {
this.$('.doc-desc').jTruncate({length: 5, minTrail:0, moreText:""});
},
[/code]
yours
Alexander
Allan