Are there problems with the Assigned Column Width Example?

Are there problems with the Assigned Column Width Example?

DaraiiDaraii Posts: 2Questions: 1Answers: 0

I need to assigned the width of a table with fixed columns and I'm using example https://datatables.net/extensions/fixedcolumns/examples/initialisation/size_fixed.html. I don't know if I'm not understanding the example correctly but according to what I understand the first column is supposed to be 200px wide, but it is not.

I also created a JSFiddle with the code of the example but can't get the width to change: https://jsfiddle.net/daraii/u7m4cLp1/4/.

Is this an issue with the FixedColumns plugin?

Answers

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin

    I think it isn't FixedColumns that is the issue, but rather the width assignment in DataTables core. If I just use DataTables the same problem can be seen.

    I'll need to look into this further. I know what is happening - the browser is collapsing the table down to try and fit into the space that is available, overruling the 300px column with that is assigned. I'm not sure what the correct way to override it will be though...

    Allan

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin

    I've committed a change that addresses this. I always get really nervous around the column widths as it is very fragile, but I think this is the right thing to do. The fix is to set a min-width, so if a wider width is needed, then it shouldn't be a problem as it will have no effect. The unit tests are all passing at least!

    It will be in the nightly build soon, and I'd welcome you trying it out before I got for a release.

    Allan

  • DaraiiDaraii Posts: 2Questions: 1Answers: 0

    Thank you for your hard work!

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin

    An update on this one - I've had to revert this change as it has caused a number of issues that have been flagged up with people expecting their table columns to collapse down and they no longer are.

    I need to look into a better option for this - possibly inserting a "forcing" element to ensure that the width property is adhered to. More research required.

    Allan

Sign In or Register to comment.