问题
I have used responsive feature of datatable. For large screen, the view is like this:
For small screen, the view is like this:
Those views are completely fine. The issue arises when the page is loaded at small screen at first, after that if the screen is being resized to large screen, views looks like this:
The width is not same as first screenshot. How to solve the issue?
Working Demo
回答1:
Try setting autoWidth: false
var table = $('#example').DataTable({
autoWidth: false,
responsive: ...
});
codepen
来源:https://stackoverflow.com/questions/58216320/jquery-datatable-width-changed-wrongly-at-the-time-of-resizing-screen-from-small