Buttons with specific class is not displayed
Buttons with specific class is not displayed
marcpirat
Posts: 51Questions: 18Answers: 0
I use datatable with buttons plugings and bootstrap style.
With this code
var url = '/i18n/' + '[(${#authentication.getPrincipal().getLang()})]' + '.json';
var productTypesTable = $('#productTypesTable').DataTable({
responsive: {
details: {
display: $.fn.dataTable.Responsive.display.childRowImmediate,
type: ''
}
},
"language": {
"url" : url
},
dom: 'Bfrtip',
buttons: {
dom: {
button: {
tag: 'button',
className: ''
}
},
buttons: [
{
extend: 'copy',
className: 'btn btn-primary',
text: '[(#{productType.new})]', //should come from thymeleaf
action: function ( e, dt, node, config ) {
$("#productTypesFragment").load("/template/new/producttypes");
}
}
]
},
"bLengthChange": false, //hide 'show entries dropdown
'pagingType': 'simple_numbers'
});
Buttons is not displayed
This discussion has been closed.
Answers
Hi @marcpirat ,
That's normally because you haven't included the JS and CSS files. Take a look at the example here - on the bottom of the page you'll see tabs for Javascript and CSS, make sure you have the listed files (your versions may vary) present in your code.
Cheers,
Colin
A little meta, but:
Hurrah - this is discussion 50'000 in the forum! .
in fact I search my button only have this class 'btn btn-primary' tried to use extend, is there any way?
because if i need to add another css, js only to extend to be able to use another class.. it's soso
Hi @marcpirat ,
This page here has an example of the
extend
forcopy
.But yes, you need to have that extra JS/CSS, that's where the code lies.
Cheers,
Colin
will be more logic to modify directly buttons.bootstrap4.min.js instead to add css, js need to extend something i will not use
That's an option, but modifying a packaged file means that any upgrade path would be complicated.