nunu nunu - 1 year ago 253
SQL Question

jquery datatables word wrap not working

My datatable's column looks wider if the value is too long.

enter image description here

i have following this and this.
And setting the width :

aTable = $("#printdata").dataTable({
"bAutoWidth" : false,
"bRetrieve" : true,
"scrollY": 200,
"scrollX": true,
"deferRender": true,
"scroller": {
loadingIndicator: true
"bServerSide": true,
"bProcessing": true,
"sAjaxSource": 'show2ndsampling.php',
"fnServerData": function (sSource,aoData,fnCallback){
"order" : [[1,"desc"]],
"aoColumns" : [
/*serial*/{ "width": "30%", target : 3 }

But there is no change in my datatable.

Answer Source

I would do this

table.dataTable tbody td {
  word-break: break-word;
  vertical-align: top;

demo ->

This is implied that autoWidth is set to false and you have given the columns a fixed width (as in the demo and as OP have described he does with aoColumns / columns).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download