Columns resize with multiple clicks

Columns resize with multiple clicks

chansonchanson Posts: 5Questions: 0Answers: 0
edited February 2012 in General
Hello. First off, I just started using the plug-in and love it, such a great tool! I was wondering if anyone else has had this issue: when I click on a column in the table (sometimes once, sometimes a couple times) the column resizes. This is pretty chaotic and I was wondering how I could stop it? I noticed all of the demo tables don't have this issue. I (to the best of my knowledge) am using the demo css sheets. I set the wrapper with $.fn.dataTableExt.oStdClasses.sWrapper = "demo_table" (it's possible this is wrong as well. Any thoughts/comments/questions are appreciated!

Replies

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin
    First thing to do is use 1.9.0 if you aren't already doing so as that has fixes in this area. If that doesn't do it, then the second thing to do is to give me a link to a simple test case so I can see it in action and fix it :-)

    Allan
  • chansonchanson Posts: 5Questions: 0Answers: 0
    Thanks for pointing out the update, I didn't realize the version had changed! It turns out there is not an issue, but rather I was missing something obvious. When I sort, depending on the columns I sort the columns resize to match the longest item in each column. I've looked around for a way around this and found you talking about overflow: hidden and fnAdjustColumnSize but neither seem to work. Overflow hidden seems promising, but I can't get it to operate. I noticed in demo_table.css you have div.box at the end with an overflow call in there. I changed this to hidden but it did not change anything. It's been a while since I've used CSS extensively, do I need to make a special call to activate it? Or put the overflow tag somewhere else maybe?
  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin
    So basically you want the contents of the cells to be cut short? There isn't a trivial way to do this with CSS unfortunately - the best way off the top of my head is to wrap the content of each cell in a DIV, set the width of the DIV (perhaps based on a class assigned to the cell) and have the DIV overflow:hidden.

    My div.box class is just for display outside the table - nothing to do with the table itself.

    Allan
  • chansonchanson Posts: 5Questions: 0Answers: 0
    Hmmmm ok thanks for letting me know! I'll play around with that and a couple other ideas and if I come up with anything useful I'll post it incase someone else would find it useful :)
This discussion has been closed.