How to change width

How to change width

shinokadashinokada Posts: 4Questions: 0Answers: 0
edited November 2009 in General
The first one of table column is ID and because it is very short, the arrow image on the right-side of ID comes top of ID.

It seems that width of each column is dynamically generated by js.

How can I over-write it so that I can increase the width of a column for ID?

Thanks in advance.

Replies

  • izzy6150izzy6150 Posts: 49Questions: 0Answers: 0
    Hi shinokada,

    The solution for this that you required is the following:

    in your initialization code use the sWidth for the columns you wish to set and turn off the Auto Width like so:
    [code]
    var oTable = $('.selector').dataTable({
    "bAutoWidth": false, // This turns off auto column widths
    "aoColumns": [ { "sWidth": "10%" }, // This is the ID column
    { "sWidth": "90%" } // the sWidth can be set for all columns if required
    ]
    })
    [/code]

    The if the sWidth is not specified on all columns then the width of those will be determined by the browsers rendering engine i believe.

    Hope this helps.

    Regards,
    Izzy
This discussion has been closed.