I am having trouble setting up a custom dataTables that uses the Buttons plugin.
I can set up a custom default dom
layout that works:
//vanilla dom (frtip...)
$.extend($.fn.dataTable.defaults, {
dom: 'frtip'
});
But if I try to include the "B" character in the dom
layout:
// Invoke Buttons plugin (Bfrtip...)
$.extend($.fn.dataTable.defaults, {
dom: 'Bfrtip'
});
...then run dataTables, this JavaScript error is reported:
Uncaught TypeError: Cannot read property 'buttons' of undefined
What am I doing wrong?
Please see an example of this at https://jsfiddle.net/jhfrench/at83rcoL/
dom
can be turned off and thedom
option can still mention them and it won't blow up. Sadly, for the buttons plugin, you either have to omit theB
if you aren't using buttons on a given DT instance, or ensure that ifB
is indom
, thatbuttons
is defined in the options. This makes setting a nice defaultdom
value sitewide that includesB
problematic, as it assumes every instance will have buttons. Next time I work on this I'm going to try setting a default ofbuttons: false
orbuttons: []
and see if that fixes it. – Bascomb