vs

vs

ValkrysaValkrysa Posts: 2Questions: 0Answers: 0
edited February 2013 in DataTables 1.9
Post is with respect to datatables and accompanying css version: 1.9.4

So I've encountered some rather weird behavior (fix included).

On my fluid layout page I have a table which gets datatable applied to it, the tables css was defined as:

what I discovered is that if the style is declared this way and the page is resized to be much smaller than it originally was the table will not resize with the page and will instead start coming out of the right side of the page.

Alternatively, if you declare the tables style as:

the table will correctly shrink as much as possible with the page (it will still eventually come out but only at super small sizes, of course that is entirely expected)

Anyways, so that was the problem encountered and the fix I used to get around it; I just wanted to make sure to put that out there just in case someone else wonders about that behavior.

Replies

  • allanallan Posts: 61,609Questions: 1Answers: 10,088 Site admin
    This topic is discussed a bit in this example: http://datatables.net/release-datatables/examples/basic_init/flexible_width.html .

    So the different behaviour is expect. The problem is that we can't just check to see if the width is 100% from CSS - example: http://live.datatables.net/ekuper/edit#javascript,html . Even although it is 100% in the CSS, it gives a pixel value which really isn't very useful... It would sure make my life easier if we could get the real value without doing a horrible parse of the CSS rules.

    Allan
  • ValkrysaValkrysa Posts: 2Questions: 0Answers: 0
    Thank you for your response, that explanation makes complete sense.

    I'd also like to take this opportunity to thank you for this great product, my own custom solution was never going to be as intuitive as datatables.
  • allanallan Posts: 61,609Questions: 1Answers: 10,088 Site admin
    Thanks very much :-)

    I should point out that `width="100%"` doesn't currently work on scrolling tables. I opened this bug to be resolved in 1.10 thanks to the prompt from your post, as I think it should: https://github.com/DataTables/DataTables/issues/162 .

    Allan
This discussion has been closed.