-
-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Column width broken since version 2 #274
Comments
Can you create a test case showing the issue please? You can use https://live.datatables.net or JSFiddle if you can't host it yourself. |
I narrowed down the issue to this:
If I comment this, it renders as it did with 1.x |
|
If the width is smaller than the content, allow the content split into multiple lines. |
It isn't ignored, it is just overwritten. Take the first column - you've assigned a width of 50px it, but the content is around 140px (including padding) and it can't be displayed any smaller than that. Therefore the width gets overridden. There is no overflow of a table cell. You could use: table {
table-layout: fixed;
} if you want to allow overflow of table cells, but it obviously looks awful: I think DataTables is operating as I would expect here. |
Can you create a test case with showing those latest images (with fake data if needed) please? If you remove a column the content should have more space to spread over, and I would expect the table to do that. |
https://live.datatables.net/jaxeferu/20/edit Check this example, I added a button for toggle. More specificaly, Name has no width Age has a fixed width, Name changes width, and it is expected, Age changes width and it should not because of fixed width. |
From my point of view this causes the issue:
|
That's what sets the sizes, so yes, any issue with the column widths would eventually setup there. It can't simply be removed unfortunately. Auto width being disabled is actually part of the problem - removing it (i.e. allowing the default enabled state) means that the age column will be 100 width: https://live.datatables.net/dogazawe/1/edit . I need to dig into what DataTables is doing when auto width is disabled - I can't recall off the top of my head! I remember trying to simplify it for v2, and I came close to removing the auto width option entirely (I've long regretted putting it in :)). For the moment, unless I'm missing something, it seems that your issue is resolved with auto width enabled? |
I will try it out and get back to you. |
@AllanJard I tried with auto width true, it is worse. |
This part should run only if autowidth is set to true. |
It seems to be running as expected without autoWidth being disabled in the link I gave above. I won't be reverting it to how v1 worked, but it certainly sounds like I need to look more into what is happening when autoWidth is disabled. I will do that, but I fear it might be a little while before I can do so due to a backlog of other things. |
Expected: render the column with with the specified value in the config
Actual: width has a calculated value not the one from config
Is there a way to fix this? With version 1.x this worked as expected.
With version 1.x the width was set on the table cell now it is set in the colgroup.
The text was updated successfully, but these errors were encountered: