Merge pull request #10857 from uberbrady/fix_bs_tables_export_options

Fix bs tables export options
This commit is contained in:
snipe 2022-03-22 17:03:18 +00:00 committed by GitHub
commit 729b23c0cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,7 +30,11 @@
return false; return false;
} }
$('.snipe-table').bootstrapTable('destroy').bootstrapTable({ $('.snipe-table').bootstrapTable('destroy').each(function () {
export_options = JSON.parse($(this).attr('data-export-options'));
export_options['htmlContent'] = true; //always enforce this on the given data-export-options (to prevent XSS)
$(this).bootstrapTable({
classes: 'table table-responsive table-no-bordered', classes: 'table table-responsive table-no-bordered',
ajaxOptions: { ajaxOptions: {
headers: { headers: {
@ -75,9 +79,7 @@
export: 'fa-download', export: 'fa-download',
clearSearch: 'fa-times' clearSearch: 'fa-times'
}, },
exportOptions: { exportOptions: export_options,
htmlContent: true,
},
exportTypes: ['csv', 'excel', 'doc', 'txt','json', 'xml', 'pdf'], exportTypes: ['csv', 'excel', 'doc', 'txt','json', 'xml', 'pdf'],
onLoadSuccess: function () { onLoadSuccess: function () {
@ -85,7 +87,7 @@
} }
}); });
});
}); });