Show/Hide columns function changes the width of the displayed columns - How to prevent?

Show/Hide columns function changes the width of the displayed columns - How to prevent?

LenWrightLenWright Posts: 6Questions: 0Answers: 0
edited November 2011 in General
Hi,
I have a table with ten columns, each with an appropriate width (200px for the first column and every other column is 60px). When I choose to hide some columns (using ColVis), the first column width changes from 200px to an increased value equal to the pixel width of the hidden columns.

I want to keep the first column always = 200px.

Can I do that?


Here is the "before" image

http://s1138.photobucket.com/albums/n524/lenwright1/before.png


Here is the "after" image

http://s1138.photobucket.com/albums/n524/lenwright1/After.png

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    not sure, but try setting bAutoWidth: false
  • LenWrightLenWright Posts: 6Questions: 0Answers: 0
    thanks for your suggestion - I should have mentioned that I've already done that. I tried with bAutoWidth: false, and

    "aoColumns": [{ "sWidth": "200px" }, { "sWidth": "60px" }, { "sWidth": "60px" }, { "sWidth": "60px" }, { "sWidth": "60px" }, { "sWidth": "60px" }, { "sWidth": "60px" }, { "sWidth": "60px" }, { "sWidth": "60px"}, { "sWidth": "60px"}]
  • brandenespinozabrandenespinoza Posts: 1Questions: 0Answers: 0
    Sorry to bump, but I have this problem as well. I'm developing for IE 7+. I had luck fixing the width of col 0 by invoking and that remains constant as I toggle columns. However, the remaining active columns are inconsistent and uneven when resizing upon toggle. Not sure what to do. I've tried everything. Invoking the derpicated col element is all I can do.
  • jcrawfordjcrawford Posts: 172Questions: 0Answers: 0
    What I think is happening is DataTables is adjusting the width of the column so that the display of your table will be correct. When you start hiding columns you start leaving gaps in place.

    I am not sure if the cause is because you have a fixed width on your table or something to that effect but it's just a guess :)
This discussion has been closed.