About the style on extend collection button group

About the style on extend collection button group

cmanskycmansky Posts: 9Questions: 4Answers: 0

Hello everyone,
Can anyone tell me, is it possible to adjust the button style on the "extend: collection"?
I already tried
"initComplete: function() {
var dropdownbtns = $('.dt-button');
console.log(dropdownbtns)
dropdownbtns.addClass('btn btn-primary');
dropdownbtns.removeClass('dt-button');
}"
but it does not work.

Answers

  • allanallan Posts: 61,714Questions: 1Answers: 10,103 Site admin

    At the moment you can do it like this:

        {
          extend: 'collection',
          className: 'btn-primary',
          text: 'Drop down',
          init: (dt, node) => node.removeClass('btn-secondary'),
          buttons: [
            { text: 'First' },
            { text: 'Second' },
            { text: 'Third' },
          ]
        }
    

    Example: https://live.datatables.net/boxujixi/1/edit .

    I'm actually working on some changes at the moment which should make this easier in future.

    Allan

Sign In or Register to comment.