Can someone give me an example of how to add a nowrap="nowrap" to a column when all information is generated on the fly for an ajax table?
$('#results').dataTable({
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
$(nRow).attr('id', aData[0]);
return nRow;
},
"bAutoWidth": false,
"sPaginationType": "full_numbers",
"bProcessing": true,
"sAjaxSource": 'ajax/purchasers.php',
"aaSorting": [[1,'asc']],
"aoColumns": [
{ "bVisible": false },
null,
null,
null,
null,
null,
null,
null
]
});
I know this might be a long shot. Thanks in advance.
It's better to achieve this through styling instead.
in the stylesheet
In case anyone is interested in the solution, you can use fnInitComplete to loop over the table after DataTables is done rendering it like so:
While it certainly will work to add a class and create a CSS entry for this it seems like using a hammer to pound in a screw.
Datatables already provides an easy way of doing this.
In your dataTable declaration add:
Hope this helps