覆盖按钮类

时间:2018-06-02 03:07:19

标签: javascript datatable

在数据表中我使用按钮扩展名 https://datatables.net/extensions/buttons/

$('#productTypesTable').DataTable({
    dom: 'Bfrtip',
    buttons: [
     {
         text: '[(#{factory.new})]', 
         action: function ( e, dt, node, config ) {                          
              $("#factoriesFragment").load("/template/new/factories");
         }
      }
    ], 
    "bLengthChange": false, 
    'pagingType': 'simple_numbers'
});

实际上生成此代码

<div class="dt-buttons btn-group">
  <button class="btn btn-secondary" tabindex="0" aria-controls="factoriesTable"><span>Nouvelle usine</span></button>
</div>

我搜索覆盖btn-primary的btn-secondary

我试过

dom: 'Bfrtip',
buttons: {
  dom: {
    button: {
      tag: 'button',
      className: ''
    }
  },
  buttons: [{
    extend: 'copy',
    className: 'btn btn-primary',
    text: '[(#{productType.new})]', 
    action: function ( e, dt, node, config ) {
      $("#productTypesFragment").load("/template/new/producttypes");
    }
  }]
},

但按钮消失

0 个答案:

没有答案