Skip to content
Snippets Groups Projects
Commit a10e0bc3 authored by Benjamin Bertrand's avatar Benjamin Bertrand
Browse files

Fix Cannot read property '_buttons' of undefined

The buttons should only be created if the items_table exists

JIRA INFRA-584
parent 71ccf5c4
No related branches found
No related tags found
No related merge requests found
...@@ -93,18 +93,20 @@ $(document).ready(function() { ...@@ -93,18 +93,20 @@ $(document).ready(function() {
] ]
}); });
new $.fn.dataTable.Buttons(items_table, { if( $("#items_table").length ) {
buttons: [ new $.fn.dataTable.Buttons(items_table, {
{ buttons: [
text: '<span class="oi oi-data-transfer-download" title="Export to excel file" aria-hidden="true"></span> Excel', {
className: "btn-outline-secondary", text: '<span class="oi oi-data-transfer-download" title="Export to excel file" aria-hidden="true"></span> Excel',
action: function ( e, dt, node, conf ) { className: "btn-outline-secondary",
download_excel(); action: function ( e, dt, node, conf ) {
download_excel();
}
} }
} ]
] });
});
items_table.buttons().container().appendTo("#items_table_wrapper .col-md-3:eq(0)"); items_table.buttons().container().appendTo("#items_table_wrapper .col-md-3:eq(0)");
}
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment