sWidth - all columns mysteriously sum to 1029px

sWidth - all columns mysteriously sum to 1029px

Alex3917Alex3917 Posts: 11Questions: 0Answers: 0
edited August 2013 in General
So I have a table with 3 columns, and I am using sWidth in the aoColumns for each. I know that I'm doing this correctly, because I can see the styles being applied inline to the appropriate cell when using Firebug. Also, when I change each of the widths, the columns do resize.

The problem is that the columns aren't resizing to the widths they are supposed to be. Instead, the all three columns are resizing somewhat arbitrarily so that the sum of their widths is 1029px. bAutoWidth is set to false in dataTableDefaults, which this table instance extends.

Any idea why this would happen? I can't seem to find any CSS that should be doing this.

Replies

  • Alex3917Alex3917 Posts: 11Questions: 0Answers: 0
    So I figured out the general issue. The table is within a div with an ID called content, that is automatically getting a size from ... somewhere. I can't see any anything that would get applied in any of my CSS files. Would datatables assign a width to the enclosing div?

    Also, the table itself is set to width: 100%. I also don't see this in any of my CSS. Is there a way to disable this with datatables?

    For reference I'm using Grails, so it's possible that there is some CSS that's being imported via magic that I can't see, so I need to look into this further. But if there is a way to fix this on the Datatables end then that would be great.

    (As a workaround for now though I can add a width to that div just using inline CSS.)
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    > Would datatables assign a width to the enclosing div?

    No. Only to the header cells.

    Can you link to a test case showing the issue please?

    Allan
This discussion has been closed.