Columns are not resized when changing browser window dimensions

Columns are not resized when changing browser window dimensions

tr333tr333 Posts: 12Questions: 0Answers: 0
edited March 2012 in DataTables 1.9
I've found a problem with table resizing and hidden columns in 1.9.0.

If you view the test case in a browser window at full screen size and then resize the browser window to be smaller, then the columns in the table are not resized to fit in the new table dimensions. This only occurs in the test case when the first column is hidden. If "bVisible" is set to "true" for column 0, then the problem disappears and the column widths are resized correctly.

Test case:
http://live.datatables.net/azuxag/2

Replies

  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin
    Just add width="100%" to your table: http://live.datatables.net/azuxag/3/edit

    See: http://datatables.net/release-datatables/examples/basic_init/flexible_width.html

    Allan
  • tr333tr333 Posts: 12Questions: 0Answers: 0
    Thanks. I've got it working by adding the following to my CSS:

    [code]table.dataTable {
    border-collapse: collapse;
    width: 100%;
    }[/code]

    Any particular reason why border-collapse is not set for the themeroller stylesheet on the CDN? People may disagree with me, but I think it looks much nicer to not have any borders between the table cells with the themeroller stylesheet enabled. Not that it really matters, since it's trivial to add the CSS to change this.
  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin
    > Any particular reason why border-collapse is not set for the themeroller stylesheet on the CDN?

    Yes - I forgot to put it in :-(

    I've just added it and it will be in 1.9.1 on the CDN, which will be released in the not to distant future (hopefully about a week).

    Allan
  • tr333tr333 Posts: 12Questions: 0Answers: 0
    Thanks.

    I just realised I had to use [code]width: 100% !important;[/code] as it was only working for some of my tables and not others. Not sure what was overwriting the CSS declarations.
This discussion has been closed.