简体   繁体   English

jQuery 数据表响应式按钮

[英]jQuery datatables responsive buttons

I am working the (fantastic) jQuery DataTables plugin and have begun to use the 'Responsive' extension so that it responds well on varied devices etc.我正在使用(很棒的)jQuery DataTables 插件,并且已经开始使用“响应式”扩展,以便它在各种设备等上都能很好地响应。

It is working fine however it adds some buttons to allow each row to be expanded to show the columns which have been hidden.它工作正常,但是它添加了一些按钮以允许展开每一行以显示已隐藏的列。

However, this is actually really annoying since it shows all the columns I have deliberately not shown as well as not looking ideal (imho).然而,这实际上真的很烦人,因为它显示了我故意没有显示的所有列,而且看起来也不理想(恕我直言)。

Does anybody know how to remove these buttons?有人知道如何删除这些按钮吗?

Cheers,干杯,

Jack杰克

I did a bit more or an intensive search of the docs and found that these 'expanded rows' are refered to as child rows and can be disabled as follows.我对文档进行了更多或密集搜索,发现这些“扩展行”被称为子行,可以按如下方式禁用。

Initially I simply included the最初我只是简单地包括

"responsive": true,

tag in my datatables.在我的数据表中标记。 These child rows may be disabled with:这些子行可能会被禁用:

"responsive": {
    "details": false
},

I thing you can override the CSS style of this button and hide it from user:我认为您可以覆盖此按钮的 CSS 样式并向用户隐藏它:

table.dataTable.dtr-inline.collapsed>tbody>tr>td:first-child:before,
table.dataTable.dtr-inline.collapsed>tbody>tr>th:first-child:before {
    display:none
}

Change also the padding of the cell:还要更改单元格的填充:

table.dataTable.dtr-inline.collapsed>tbody>tr>td:first-child,
table.dataTable.dtr-inline.collapsed>tbody>tr>th:first-child {        
    padding-left: 10px; /* Instead of 30px */
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM