-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
datatables 采用bootstrap的tab方式,表头会缩在一起,为什么? #9
Comments
假设tab组有3个页面,难道不该是监听每个tab的click事件来进行tab页内容的draw么? 延时(事件触发)、异步(ajax局部刷新)加载,应该是一个web页基本的优化方案吧。。。。 |
我看了这个官方的example,他这个数据是前端直接塞过来的array.txt。。 根据我们项目的开发经验,数据统计系统中,包括echarts的绘制,必须是监听tab的click切换来进行加载,而不是页面document.ready时加载全部tab中所有的echarts或者dt的内容。 否则,用户要骂娘了。。。 |
附赠Bootstrap中tab切换的监听,tabs-event。 注意show.bs.tab和shown.bs.tab的区别。。。 |
stackoverflow找个一个佐证。。 bootstrap2.x时代,就已经异步加载tabs内容了。。 |
我也在tab里面用过bootstrap,一楼的方法是正确的 |
解决tab内表格错位的方法,亲测可用 |
错位解决了 但是里面分页没有!! |
怎么去解决 |
@ladesjake 同学。。你怎么也得贴点代码吧? |
@ladesjake 不懂什么叫分页没有了,重新开issue讨论吧,记得贴上代码和问题描述,最好还带上截图 |
每次我的都会锁在一起,从新查下数据或手动更改浏览器长宽,就又好了,郁闷了啊 |
原因分析:
tab在没有显示之前,容器是没有高度宽度的,而dt在自动计算高度和宽度时是获取的外部容器的高度和宽度,当切换tab时,dt获取不到这个高度宽度,导致列头都挤在一起,是用下面代码解决此问题
以上代码来自:$.fn.dataTable.tables() 获取该页面上所有的DataTables实例
官方在线演示参考这里
补充
The text was updated successfully, but these errors were encountered: