Cannot specify column widths

Cannot specify column widths

Ironwil616Ironwil616 Posts: 50Questions: 0Answers: 0
edited October 2011 in General
I've tried 'aoColumns', 'aoColumnDefs' and then finally just put a div in each th and td to specify the width of the columns. Nothing works, at least not when I use the 'sScrollX' option. First, the column headers and their data fields were misaligned, which I've never seen in a table before. The td cells were scrunched up, and generally the table looked terrible. Then I put in the div's to force the width issue (yes, ugly hack, but I'm really under the gun to finish this), and this still didn't work. The th elements were all given way more width than the divs I placed inside them. Using Chrome, I looked at the widths, and found that a th with a div that had a width of 250px was assigned a width of 451px. In the styles breakdown this was listed under 'element.style', so I can only assume datatables is assigning this for some reason.

Someone please help! I just want to give column widths and have it stick. No overwriting - just render as specified.

Replies

  • Ironwil616Ironwil616 Posts: 50Questions: 0Answers: 0
    Just a quick update - adding divs to the th and td elements does work for specifying column widths, although with an extra 20 px of padding that is CSS-related. But, if I try to enable scrolling, my widths all get thrown out the window.
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    have you set bAutoWidth: false?

    http://www.datatables.net/ref#bAutoWidth
This discussion has been closed.