omines / datatables-bundle

DataTables bundle for Symfony
https://omines.github.io/datatables-bundle/
MIT License
260 stars 114 forks source link

Multiple button group with Omines #305

Closed modibo-26 closed 1 year ago

modibo-26 commented 1 year ago

Hi all, I am attempting to include another group of button options on some of my tables with Symfony 6

I would like do like this code on https://datatables.net/extensions/buttons/examples/initialisation/multiple.html docs new $.fn.dataTable.Buttons( table, { buttons: [ { text: 'Button 2', action: function ( e, dt, node, conf ) { alert( 'Button 2 clicked on' ); } }, { text: 'Button 3', action: function ( e, dt, node, conf ) { alert( 'Button 3 clicked on' ); } } ] } );

table.buttons( 1, null ).container().appendTo(
    table.table().container()
);

I tried : $('#dt').DataTable({ buttons: [ { text: 'Button 2', action: function (e, dt, node, conf) { alert('Button 2 clicked on'); } }, { text: 'Button 3', action: function (e, dt, node, conf) { alert('Button 3 clicked on'); } } ] }).buttons(1, null).container().appendTo( $('#dt') );

or : $.extend($.fn.dataTable.defaults, { dom: 'frtipB', buttons: [ { text: 'Button 2', action: function (e, dt, node, conf) { alert('Button 2 clicked on'); } }, { text: 'Button 3', action: function (e, dt, node, conf) { alert('Button 3 clicked on'); } } ] });

But no button appears. Any insights would be apprecied