Datatables buttons save to excel and print to pdf do not work if there are two or more tables.
Datatables buttons save to excel and print to pdf do not work if there are two or more tables.
jmenriquem
Posts: 1Questions: 1Answers: 0
When I put two or more tables on a html page, the extension buttons does not work properly. In fact, the buttons save to excel and print to pdf do not work at all. Is there is only one table it works fine. The code I used was the following:
$(function() {
$('#operationList').DataTable(
{
// Components layout
dom : 'Blfrtip',
buttons : [ 'colvis', {
extend : 'colvisGroup',
text : 'Mostrar Todos',
show : ':hidden'
}, {
extend : 'copyHtml5',
text : 'Copiar'
}, {
extend : 'print',
text : 'Imprimir',
message : 'Listado de Operaciones.'
}, {
extend : 'csv',
text : 'CSV',
fieldSeparator : ',',
title : 'Listado_de_Operaciones',
extension : '.csv'
}, {
extend : 'excel',
title : 'Listado_de_Operaciones',
text : 'Excel'
}, {
extend : 'pdf',
text : 'PDF',
pageSize : 'A4',
orientation : 'landscape',
message : 'Listado de Operaciones.',
title : 'Listado_de_Operaciones'
} ],
// Components theme
jQueryUI : true,
lengthChange : true,
autoWidth : true,
// Filter
searching : true,
// Info of total entries
info : true,
// Scroll
/*
* "scrollX": "100%", "scrollXInner": "110%", "scrollY":
* "200px", "scrollCollapse": true,
*/
// Save table state
stateSave : false,
// Pagination
paging : true,
pagingType : 'full_numbers',
// Sorting
ordering : true,
order : [ [ 1, 'asc' ], [ 2, 'asc' ], [ 3, 'asc' ],
[ 4, 'asc' ], [ 5, 'asc' ], [ 6, 'asc' ],
[ 7, 'asc' ] ],
columns : [ null, null, null, null, null, null, null, null,
{
'type' : 'number',
'class' : 'right'
}, {
'type' : 'number',
'class' : 'right'
} ],
// Localization
language : {
url : 'plugins/datatables/i18n/Spanish.json',
buttons : {
colvis : 'Visualizar Campos'
}
},
responsive : true,
processing : true,
serverSide : true,
ajaxSource : '/TCAppWEB/operation-by-farm-list?farmId='
+ $('#selectedFarmId').prop('value')
});
});
This issue affects to DataTables 1.10.12. DataTables 1.10.11 works fine when I put two or more tables on a html page, so I think there must be a bug on 1.10.12 release.
Thanks in advance.
This discussion has been closed.
Answers
Seems to work without issue in this trivial example.
Can you link to a page showing the issue, per the forum rules, so I can debug it please.
Thanks,
Allan