DataTables 2.2.0 data population and column resizing
DataTables 2.2.0 data population and column resizing
I was hoping to just upgrade to DataTables 2.2.0 from 2.1.8 without any code changes or issues, but columns are not adjusting like previously when a table is cleared and new rows added.
I know I need to work up a test case so that it can be debugged appropriately. I can't load videos to show the issue so I will try to describe in images.
With DataTables 2.1.8 there are 4 images, the details table column layout looks like I would expect it.
[DataTables 2.1.8] No parent rows selected and the details table column layout looks like I would expect it.
[DataTables 2.1.8] After selecting the 1st parent row the details table is populated and the column sizing looks like I would expect it.
[DataTables 2.1.8] After selecting the 2nd parent row the details table is populated and the column sizing looks like I would expect it.
[DataTables 2.1.8] After selecting the 1st parent row again the details table is populated and the column sizing looks like I would expect it.
With DataTables 2.2.0 there are 4 images mirroring the 2.1.8 images.
[DataTables 2.2.0] No parent rows selected and the details table column layout is already different with the last column species out of view.
[DataTables 2.2.0] After selecting the 1st parent row the details table is populated and the column sizing is not what I expected.
[DataTables 2.2.0] After selecting the 2nd parent row the details table is populated and the column sizing is almost what I expected
[DataTables 2.2.0] After selecting the 1st parent row again the details table is populated and the column sizing is not what I expected.
Answers
Could you try the just released 2.2.1 which I hope will address this error.
If it doesn't (I think it should!) can you link to a page showing the issue please?
Allan
Sorry @allan 2.2.1 did not fix the issue. The images are the exact same between DataTables 2.2.0 and 2.2.1. I will attempt to work on a test case, but it might take through the weekend.
I verified the DataTables 2.2.1 is the version loaded in the browser.
Our website is internal only for the National Cancer Institute (NCI) staff.
Just a quick note. In 2.2.0+ If no data is in a column it looks like the width is not condensed but shown as it's defined width.
Where as in 2.1.8 it condenses columns with no data.
Not sure if I am correct, but that is what it looks like.
I strongly suspect you have encountered this line from this commit.
Are you using
columns.width
? I fear it will be a test case that is needed.Allan
I have a test case: https://live.datatables.net/xaziwube/2/edit?output
The best way to see the issue is to have the browser at about 90% of the window and watch how the Reason column is or isn't resized between 2.18 and 2.2.1
The test case only shows the Output and is currently set to DataTables 2.1.8. You can then go to the html and switch to 2.2.1
So would you consider that commit has a breaking change/fix?
I guess it is now interpreting if scrollX: true then the minimum width is set to the column defined width.
I will need to change about 80 DataTable definitions, which is fine I just need to remember how things work.
So I am try to consider the following:
I was typically defining widths for all of my columns except for long text (comments).
So in the linked test case if I was to define scrollX: true I would consider defining the Reason width to something minimal like (20) so if all the records were null then it wouldn't take a lot of space.
Not sure if you have a simple description/example of how the define column widths and scrollX
Apologies, I forgot to reply about this today. Let me do so over the weekend. I had it open on a tab on my phone, so I missed it when looking at the new posts!
Allan