jQuery datatable width changed wrongly at the time of resizing screen from small screen to large screen

╄→尐↘猪︶ㄣ 提交于 2021-01-27 19:30:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!