Editor Bundle - DOM Error
Editor Bundle - DOM Error
AdrianSmithUK
Posts: 26Questions: 10Answers: 0
I've downloaded a standard Editor bundle from the generator.
When I set the DOM value to:
dom: 'Bti'
I get the following error message:
"datatables.min.js:14 Uncaught Unknown button type: print"
dom: 'ti' - works fine.
I'm surprised because I don't have a print button. Just the standard New, Edit, Delete buttons.
I included the file:
//cdn.datatables.net/buttons/1.7.0/js/dataTables.buttons.min.js
But this didn't fix it.
Can anybody help?
This discussion has been closed.
Answers
Print is the default button if you don't supply the buttons you want using
buttons
. HAve you defined your Editor buttons like this example?Kevin
Hi Kevin,
I just downloaded the standard bundle that came out of the DT Editor Generator.
I modified the buttons object so it looks like this:
... and it works fine as long as I don't try to customise the DOM.
As soon as I add:
dom: 'B'
I get the error message:
"datatables.min.js:14 Uncaught Unknown button type: print"
Many thanks,
Adrian
Hi Adrian,
Could you show me the full JS that is causing the error please? It sounds like you might not have a
buttons
option in the DataTable initialisation (although you note that you modify the one created by Generator, so I’m not sure).If you don’t have a
buttons
option, then the default will be used which is to show the copy, excel, CSV and print buttons (hence the error you are seeing if you aren’t loading theprint
file).Allan
Hi Allan,
Apologies for dumping it here. I'm working on XAMPP.
/*
* Editor client script for DB table leads
* Created by http://editor.datatables.net/generator
*/
// Moved by AS
var table;
var editor;
(function ($) {
}(jQuery));
You are using the code in lines 150-158 to add the buttons. See this doc for more details. Since you are using this to add the buttons you don't need the
B
for thedom
option.Why are you trying to use
B
with thedom
option?Kevin
Hi Kevin,
I just want an Edit button at the top and the info at the bottom.
Therefore I need to edit the buttons object as follows:
If I then use:
Assuming that the buttons are being added by the function:
Can you suggest a solution?
I've found a hacky way to solve my problem. Instead of using the dom attribute I hide the search bar using CSS.
This code allows you to place the buttons where you want. Create a
div
and change the$('.col-md-6:eq(0)', table.table().container())
selector to find thediv
.Or remove that statement and use the
B
option in thedom
.Kevin
Many thanks Kevin. You have been a great help.
Kind Regards,
Adrian