buttonLiner broken in latest version of datatables-BS5

buttonLiner broken in latest version of datatables-BS5

jjsjjs Posts: 2Questions: 0Answers: 0

Link to test case:
https://codepen.io/jjsiman/pen/YzRMYzZ?editors=1111

Description of problem:
With the latest BS5 versions:
- "datatables.net-bs5": "1.13.6",
- "datatables.net-buttons-bs5": "2.4.1",
- "datatables.net-fixedcolumns-bs5": "4.3.0",

The buttonLiner option is not respected. As you can see if you inspect the dom, the buttons are still span elements.

<li class="btn btn-secondary buttons-pdf buttons-html5" tabindex="0" aria-controls="example"><span>PDF</span></li>

Replies

  • allanallan Posts: 63,791Questions: 1Answers: 10,513 Site admin

    Apologies - with v2.4.0 of Buttons I rewrote how the DOM options we constructed to make them a ton more flexible.

    I don't appear to have an option to fork or otherwise save the CodePen so this is the code to use:

    $(document).ready(function() {
        var table = $('#example').DataTable( {
            lengthChange: false,
            buttons: {
              dom: {
                button: {
                  tag: 'li',
                  liner: {
                    tag: 'a',
                  },
                },
              },
              buttons: [ 'copy', 'excel', 'pdf', 'colvis' ] 
            },
        } );
     
        table.buttons().container()
            .appendTo( '#example_wrapper' );
    } );
    

    This is the part of the code that defines the options.

    I actually dropped the documentation for them as I've very very rarely seen anyone use them, hence why this wasn't communicated as clearly as it probably should have been. In retrospect, I should have made is a v3 release, but I'd wanted other things in for that as well, which didn't make it in time.

    Regards,
    Allan

  • jjsjjs Posts: 2Questions: 0Answers: 0

    @allan that fixed it, thank you! No worries, thanks for the quick response. We were just in the processes of updating and noticed an error.

This discussion has been closed.