center buttons in the layout (using BULMA)
center buttons in the layout (using BULMA)
MelodyNelson
Posts: 213Questions: 33Answers: 2
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
Hi,
I'm using datatables with bulma.
I have added buttons in the layout :
layout: {
top3: 'searchPanes',
top2: {
buttons: [
{
extend: 'colvisGroup',
text: 'Présentation projets',
show: '.presentation',
hide: '.more'
},
{
extend: 'colvisGroup',
text: 'Tout afficher',
show: '.more'
},
{
extend: 'colvis',
text: 'Colonnes à afficher',
postfixButtons: [ 'colvisRestore' ],
collectionLayout: 'fixed columns',
collectionTitle: '<strong>Colonnes à afficher / masquer</strong>',
columns: ':not(.dtr-control, .filtre, .relancer, .ged)'
}
]
},
top1: function () {
let legende = document.createElement('div');
legende.innerHTML = '<p class="has-text-centered has-text-grey mb-3">Cliquer sur la ligne ou sur le <span class="mx-1">▶</span> pour afficher des informations complémentaires.</p>';
return legende;
}
},
This is an extract of the HTML code generated :
<div class="dt-buttons field is-grouped">
<button></button>
etc
</div>
How can I change some class in the div
inside the layout so it can be « Bulma centered buttons » ?
I need it to be written like that :
<div class="dt-buttons buttons is-grouped is-centered">
Thank you
Replies
Hmmm - I feel that is a bug actually. With 2.1 I had expected that to be centred. I'll look into that and post back with findings.
Until then, this is the property to override.
Allan
Thank you Allan
I'm not in 2.1 version yet, still in 2.0 but I will update soon to try the new features
With 2.1 it was actually working, but only for windows larger than around 767px. Smaller than that it would incorrectly pull them to the left. I've committed a fix.
Allan
Thanks for the feedback Allan
I will update my version soon
It's a newbie question but I don't know how to override this
with this kind of « short command » in my own JS file with the default options for DT I want like I did for the search input
DataTable.ext.classes.search.input = "input";
If I can delete « field » for the buttons, the vertical align will be the same in this case
somewhere before you initialise the DataTable.
Allan
Thanks Allan, it's obvious when I see it !
Is it a way I can add a class to nav.pagination because Bulma navigation buttons are so big
I did it this way and it doesn't always work
I'm changing the datatable JS file (adding is-small) but I would prefer add a change in my own preferences so the original files stay as they are