dt-responsive does not work on first load, when data in column is to long
dt-responsive does not work on first load, when data in column is to long
Hi there,
my datatable responsive won't fit correctly on a small screen if the inserted data is too big.
If the data cannot wrap I understand, that the single column exceeds the window. However even if it could fit in, the subsequent column is not hidden.
I have tried firing a resize event (window.dispatchEvent(new Event('resize'))),
I have tried using columns.adjust()
I have tried .responsive.rebuild()
I have tried. responsive.recalc()
I have tried all combinations of those.
The width of the dt is set to 100%.
Any idea, what to do?
Here is the testcase: https://live.datatables.net/zomihava/3/edit
Only after clicking on the pdf-button for example, the column to the right is correctly hidden.
Thanks for your help!
Chris
This question has an accepted answers - jump to answer
Answers
Looks like you can use either (or both)
columns.adjust()
orresponsive.recalc()
in theloadtable()
function after adding the rows. Updated example:https://live.datatables.net/vehekube/1/edit
Experiment with commenting and uncommenting the two statements.
Kevin
Thank you very much. Now it works.
I have no idea, why it didn't before...