角度数据表 - 覆盖按钮CSS

问题描述 投票:0回答:1

我使用角度5和角度数据表。

我想在自定义按钮上应用“btn btn-success”类

这是我试过的:

this.dtOptions = {
     ...
 buttons: [
     {
       text: 'Sélection',
       className: 'btn btn-success',
       ...
     }
  ]
}

这是结果:enter image description here

该类被添加,但它保留'dt-button'类,然后覆盖一些属性,如图所示

但我找不到如何删除它...

我该如何解决?

css angular5 angular-datatables
1个回答
0
投票

好的我发现:

 this.dtOptions = {
 dom: 'Blfrtip',
 initComplete:  function (settings, json) {
    $('.button').removeClass('dt-button');
 },
 buttons: [
    'print',
    'excel',
     {
          text: 'Sélection',
          className: 'table-button button btn btn-success',
          ...
        }
     ]
}

现在它有效!

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.