aoColumnDefs sWidth is not applied to the columns

aoColumnDefs sWidth is not applied to the columns

MarcBorgersMarcBorgers Posts: 6Questions: 0Answers: 0
edited August 2011 in DataTables 1.8
Hi,

I want to control the width of the columns.
According to the doc, I should be able to do that using aoColumnDefs.sWidth.
This does not seem to work.
I included my page.

What am I doing wrong?


<!--%@page errorPage="/errorPages/error.jsp"%-->
<%@taglib uri="agfatags" prefix="agfa"%>






<!--HTML HEADER SETUP -->


Agfa Licensing



<!--JAVASCRIPT SETUP -->







function sendForm(action)
{
var f = document.myform;

f.posted.value = "true";
f.actie.value = action;
f.submit();
}

function fillDataTable(idOfTableToFill) {
var oTable = $(idOfTableToFill).dataTable( {
"sDom": 'Rlfrtip',
"sAjaxSource": 'components.json.jsp',
"bAutoWidth": false,
"aoColumnDefs": [
{ "sWidth": "150px", "aTargets": [ 1 ] },
{ "sWidth": "150px", "aTargets": [ 2 ] },
{ "sWidth": "150px", "aTargets": [ 3 ] },
{ "sWidth": "150px", "aTargets": [ 4 ] }
],
"sScrollY": "300px",
"sScrollX": "400px",
// "bScrollCollapse": true,
"bPaginate": false,
"oColReorder": {
"iFixedColumns": 1
}
} );
new FixedColumns( oTable, {
"iLeftWidth": 250
} );
}

$(document).ready( function () {
fillDataTable('#example');
} );





SW Components per release

This page lists the required versions of SW Components (aka 'Technical licenses') per software release.













SW Releases:
SW Components


1.0 SU1
1.0.3203
1.0.3203 SU1
1.0.3203 SU2
2.0.1304
2.0.1703
2.0.6805
2.0.6805 SU1
2.0.6805 SU2
2008
test

Replies

  • MarcBorgersMarcBorgers Posts: 6Questions: 0Answers: 0
    I adjusted the example right_column.html. I was able to add a fixed width to the first 3 columns. When I added a fixed width to the 4th colum, it goes wrong...
  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    The first thing to check would be that you are using the latest version of DataTables. Also it it would be very helpful to be able to see a link of thing in action. Table column widths are particularly difficult, since you generally don't have pixel level control over them - the browser can overrule what widths you've applied if it thinks the sizes don't add up.

    Allan
  • little_heroinelittle_heroine Posts: 6Questions: 0Answers: 0
    i am wondering can i use aoColumnDefs to control the first column to be display once for mutiple rows. The whole table seems to be neasted.
    That is: a host may have many services, i want to display host name once in the first column, but every service is displayed as a row in the table.
This discussion has been closed.