Set custom buttons with different class names
Set custom buttons with different class names
I have 5 custom button that I would like to change the color using Bootstrap 4 classNames. I am able to override the dataTable classes by using dom: , but how do I do this for each button?
buttons: {
buttons: [
{ text: 'Time In',
attr: {id: 'timeInButton' },
action: function ( e, dt, node, config ) { timeIn() }
},
{ text: 'Lunch Out',
attr: {id: 'lunchOutButton'},
action: function ( e, dt, node, config ) { lunchOut() }
},
{ text : 'Lunch In',
attr: { id: 'lunchInButton'},
action: function ( e, dt, node, config ) {lunchIn() }
},
{ text: 'Time Out',
attr: { id: 'timeOutButton'},
action: function ( e, dt, node, config ) {timeOut() }
},
{ text: 'Create Out of Office Entry',
attr: { id: 'OutOfOfficeButton'},
action: function ( e, dt, node, config ) {createOutOfOffice() }
}
],
dom: {
button: { className: "btn btn-primary"},
buttonLiner: { tag: null }
}
},
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Further clarification... I want to change the OutOfOfficeButton to be "btn btn-secondary"
Try
buttons.buttons.className
on the individual buttons.Kevin
I have already tried that but it does not override the dt-buttons class
I use bootstrap 3 and could change the color of a button simply by using className for the individual button. Here is an example:
try this
for one button
for each button
Hendra... that did the trick. Thank You