Fixed width columns
Fixed width columns
Themicster
Posts: 1Questions: 0Answers: 0
I am using datatables to list emails, but I have a problem with displaying data in a fixed width table. I've tried applying css styles overflow: hidden; but it always seems to dynamically set the width of the column to the size of the data. How can I make the column width fixed?
Thanks,
Michael
Thanks,
Michael
This discussion has been closed.
Replies
Defining the width of the column, this parameter may take any CSS value (3em, 20px etc). DataTables applys 'smart' widths to columns which have not been given a specific width through this interface ensuring that the table remains readable.
01.$(document).ready(function() {
02. $('#example').dataTable( {
03. "aoColumns": [
04. { "sWidth": "20%" },
05. null,
06. null,
07. null,
08. null
09. ]
10. } );
11.} );
Just noticed that this is an old post reawakened - but more information can only be good information :-)
Allan
I can not operate the parameter swidth
[code]
$('#021::1').dataTable( {
"oLanguage": {
"oPaginate": {
"sFirst": "Primera",
"sPrevious": "Anterior",
"sNext": "Siguiente",
"sLast": "Ultima"
},
"sProcessing": "Trabajando ...",
"sLengthMenu": "Mostrar _MENU_ registros por pagina",
"sZeroRecords": "Upss, no hemos encontrado nada",
"sInfo": "Mostrando _START_ - _END_ de _TOTAL_ registros",
"sInfoEmtpy": "Ningun registro",
"sInfoPostFix": "",
"sSearch": "Buscar:",
"sInfoFiltered": "(filtrado desde un total de _MAX_ registros)"
},
"bSortClasses": false,
"bStateSave": true,
"bAutoWidth": false,
"sPaginationType": "full_numbers",
"sDom": '<"top"fp>rt<"bottom"li<"clear">',"aaSorting":[[3,'asc']],
"aoColumns": [
{ "bSortable": false, "bSearchable": false, "sWidth": "10px" },
{ "bSortable": false, "bSearchable": false, "sWidth": "10px"},
{ "bSortable": false, "bSearchable": false, "sWidth": "10px"},
{"sWidth": "50px"},
{"sWidth": "100px"},
null,
null,
null
]
} );
});
[/code]