本文介绍了在将屏幕从小屏幕调整为大屏幕时,jQuery数据表的宽度错误地更改了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用了数据表的responsive
功能.对于大屏幕,视图是这样的:
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?
推荐答案
尝试设置 autoWidth: false
Try setting autoWidth: false
var table = $('#example').DataTable({
autoWidth: false,
responsive: ...
});
codepen
这篇关于在将屏幕从小屏幕调整为大屏幕时,jQuery数据表的宽度错误地更改了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!