简体   繁体   中英

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.

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:

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 */
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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