How apply a Bootstrap 5 class to buttons in layout.

How apply a Bootstrap 5 class to buttons in layout.

bbrindzabbrindza Posts: 316Questions: 73Answers: 1

How apply a Bootstrap 5 class to the buttons ( ie. btn btn-sm) in the the layout .

        layout: {
            top2Start: 'pageLength',
            topStart: 'buttons',
            topEnd: 'search',
            bottomStart: 'info',
            bottomEnd: 'paging'
        },

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    Assuming you have imported the Bootstrap 5 integration for Buttons, it will automatically get Bootstrap 5 classes. That is either the datatables.net-buttons-bs5 module if you are doing ES imports, or buttons.bootstrap5.js if you are including the JS directly.

    The default is btn btn-secondary. If you want to change the default, you can do so with:

    DataTable.Buttons.defaults.dom.button.className = 'btn btn-sm';
    

    Allan

  • bbrindzabbrindza Posts: 316Questions: 73Answers: 1

    Ok , so basically added this to the JS to override the default?

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Answer ✓

    If you want btn btn-sm for all buttons, then yes.

    Allan

  • bbrindzabbrindza Posts: 316Questions: 73Answers: 1

    Thanks again Guru

Sign In or Register to comment.