JS数据表-切换显示/隐藏与自动显示其他列的响应 [英] JS Datatables - Toggle Show/Hide with responsive auto showing other columns

查看:125
本文介绍了JS数据表-切换显示/隐藏与自动显示其他列的响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个响应式数据表,该表还启用了显示/隐藏"列功能. 我注意到,每当我使用显示/隐藏按钮隐藏列时,都会自动出现一个新列,以填充页面的宽度.

I have a responsive Datatable that also has the Show/Hide columns feature enabled. I've noticed that whenever I hide a column using the show/hide buttons, a new column will automatically appear in order to fill the width of the page.

是否有一种禁用此功能的方法,以便如果我将一列切换为隐藏,另一列不会尝试填充其位置,但是现有的列恰好适合页面的宽度?

Is there a way to disable this so that if I toggle a column to hide, another column does not try and fill its place, but the existing columns will just fit the width of the page?

可以在这里找到我当前问题的测试用例: http://live.datatables .net/huruwaro/1/edit

A test case of my current issue can be found here: http://live.datatables.net/huruwaro/1/edit

感谢您的宝贵时间!

推荐答案

单击按钮后尝试重绘表格

Try to redraw the table after clicking the button

$('#myTable1').DataTable().clear().draw();

$('#myTable1').DataTable().columns.adjust().draw(); 

$('#myTable1').DataTable().columns.adjust().draw(false); 

这篇关于JS数据表-切换显示/隐藏与自动显示其他列的响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆