fnAdjustColumnSizing usage

fnAdjustColumnSizing usage

cpettifercpettifer Posts: 12Questions: 0Answers: 0
edited September 2010 in General
I'm trying to get my datatables to resize the columns when the browser window resizes. I have the following code in my screen:

$(window).resize(function() {
oTable.fnAdjustColumnSizing();
});

I can see that the code is being hit when the browser resizes, so the function is getting executed, but my datatable is not being resized. Is there anything I need to know about the use of this function / something I'm doing wrong, or a bug perhaps?

Thanks.

Replies

  • ruzzruzz Posts: 49Questions: 0Answers: 0
    Just a thought...

    It's hard to say what may be causing the problem without being able to see it. That said, if you remove all css size stuff, strip it back to bare bones vanilla html, your table will flex with the browser - no question. Once you're at that stage, add the size stuff back, one step at a time, and try to see *what* is holding your table size(s) hostage.

    You may not even need fnAdjustColumnSizing when you're done.

    HTH
    ruzz
  • cpettifercpettifer Posts: 12Questions: 0Answers: 0
    I seem to have fixed this myself. I don't even need the function above, but if I set "bAutoWidth": false on initialisation, then the data table resizes columns when the browser resizes.

    Smooth.
  • deckarddeckard Posts: 6Questions: 0Answers: 0
    edited November 2011
    Thanks, this worked for me. Seems counter-intuitive though: setting bAutoWidth to false is the only way to make the automatic width calculation work when there's a hidden column. :)
This discussion has been closed.