一组按钮组单个列的可见性
注意:这个需要使用Bottons扩展
这是两组按钮,一组为显示列的,一组为隐藏列的,分别包含相同标题的文本列按钮
This button type is included for completeness in the base set of column visibility buttons, but the
columnsToggleButton
and
columnVisibilityButton
are generally more likely to be useful.
这个按钮有以下选项配置:
名称 | 默认 |
---|---|
columns |
undefined |
Columns selector that defines the columns to include in the column visibility button set.
By default this is
undefinedType
which results in all columns being selected,
but any of the
column-selectorType
options can be used to define a custom button set.
|
|
visibility |
undefined |
当你触发按钮的时候控制你选择的列是否显示或者隐藏 |
Datatables初始化:显示两组按钮,分别包含所有列名,一列控制显示,一列控制隐藏
$('#myTable').DataTable( { buttons: [ { extend: 'collection', text: 'Show columns', buttons: [ 'columnsVisibility' ], visibility: true }, { extend: 'collection', text: 'Hide columns', buttons: [ 'columnsVisibility' ], visibility: false } ] } );
Translation from DataTables.net, with permission