How can I add 'button type' and 'id' to DataTables button?
How can I add 'button type' and 'id' to DataTables button?

I'm trying to change the 'button type' and add an 'Id' to a custom button I did. Here's the code:
dom:
"<'row'<'col-sm-4'l><'col-sm-4 text-center'B><'col-sm-4'f>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
buttons: [
{
text: 'Search',
className: 'xBtnDataTables',
action: function (e, dt, node, config) {
alert('Button activated');
}
}
]
I checked the docs and I've seen things you can add like className, text, action, extend but haven't seen how can I change the 'button type' and add an 'Id'. The end goal is that I'm trying to make that button a type=submit to submit a form when clicked, can this be done?
Thanks.
This discussion has been closed.
Answers
Hi @dataphpmysql ,
You won't be able to change the type, but you can submit the form in the
action()
code for that button. You can add the id withbuttons.buttons.attr
,Cheers,
Colin