bootstrap datatable java_DataTable Bootstrap Collection

After embedding you code on stack-snippet with the needed CDN libraries:

1) The first thing I see wrong was a darker background on the buttons. This is because the Datatables integration with Bootstrap adds class btn-secondary to the buttons. Lucky us, they provide and option called ìnit we can use to delete this class, like this:

{

extend: 'print',

init: (api, node, config) => $(node).removeClass('btn-secondary'),

className: 'btn btn-outline-success'

}

2) The second issue I note is that there is no need to add the dropdown particular classes in the className options, if you use the browser inspector you will see that they already have the correct structure and classes of Bootstrap.

Finally, you can check the complete example with the mentioned fixs:

$(document).ready(function()

{

$('.table').DataTable({

dom: 'Bfrtip',

buttons: [

{

extend: 'collection',

init: (api, node, config) => $(node).removeClass('btn-secondary'),

className: 'btn btn-outline-success',

text: 'Export',

buttons: [

{extend: 'csvHtml5'},

{extend: 'excelHtml5'}

]

},

{

extend: 'print',

init: (api, node, config) => $(node).removeClass('btn-secondary'),

className: 'btn btn-outline-success'

}

]

});

})

NamePositionOfficeAgeStart dateSalary

Tiger NixonSystem ArchitectEdinburgh612011/04/25$320,800Garrett WintersAccountantTokyo632011/07/25$170,750Ashton CoxJunior Technical AuthorSan Francisco662009/01/12$86,000
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值