column sWidth not working when scrollY is set and JSON is used!

column sWidth not working when scrollY is set and JSON is used!

nmaurernmaurer Posts: 1Questions: 0Answers: 0

I have the same problem as described in
http://datatables.net/forums/discussion/19089/datatables-bautowidth-false-not-working-when-sscrolly-is-set
but it's still not working with the nightly build (which was the solution on that discussion).
When loading through json/ajax header width is ignored and the columns get resized. You can even see how the column has one width before loading the json data and one after.
I've made a fiddle showing the problem, I'd appreciate any help!

http://jsfiddle.net/nmaurer/fa8Lbwxy/

Thanks!

Replies

  • allanallan Posts: 61,833Questions: 1Answers: 10,133 Site admin

    Taken my a while to reply this one - sorry!

    Two issues that I see with your JSFiddle:

    • The table (at least in my browser window size) is wider than that available area. So the browser tries to shrink it to fit. The 50% is effectively thrown away as it would just be whitespace.
    • It has bAutoWidth set to false so DataTables can't do its width calculations.

    With a wide consider and autoWidth enabled, the 50% is applied as expected: http://jsfiddle.net/fa8Lbwxy/1/ .

    Allan

This discussion has been closed.