Custom dom button generation
Custom dom button generation
AlbertMorenoDEV
Posts: 2Questions: 1Answers: 1
I'm trying to generate a custom dom button, like:
<button class="btn">Export</button>
It's possible?
I've tried various configurations with dom parameter, but I don't get any different response:
$.fn.dataTable.Buttons(dataTable, {
buttons: [
{
extend: 'pdf',
text: 'Export',
dom: {
button: {
tag: 'button',
className: 'btn'
}
}
}
]
});
Always I get response with a tag, and in a not wanted div container:
<div class="dt-buttons">
<a class="dt-button buttons-pdf buttons-html5" tabindex="0" aria-controls="datatable-1" href="#"><span>Export</span></a>
</div>
Thanks,
Albert
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi Albert,
It currently isn't possible to create a Buttons instance that doesn't have the contain div I'm afraid.
Allan
Okay Allan, Thanks.
For now I have solved hiding generated div and creating manually custom button with simple JS trigger a click on hidden button.
It isn't a clean solution but works...