1

I use Jquery Datatables to generate my grids, and for sure to generate Excel and PDF exported reports, what I need now is to automatically append a generic static content into the footer, that is not related to specific columns, but to the table footer as a whole, like a disclaimer comment or a generic note.

In order to generate the Excel Exports, for example, I use the following:

        var buttons = new $.fn.dataTable.Buttons(dt, {
            buttons: [
               {
                text: 'Export as CSV',
                action: function (e, dt, button, config)
                {

                    var ths = this;
                    dt.one('preXhr', function (e, s, data)
                    {
                        data.iDisplayLength = -1;
                    }).one('draw', function (e, settings, json, xhr)
                    {

                        var excelButtonConfig = $.fn.DataTable.ext.buttons.excelHtml5;
                        var addOptions = {footer: true, exportOptions: { 'columns': 'thead th:not(.noExport)', orthogonal: 'export'},'title': 'doc title', 'filename': 'filr name' };

                        $.extend(true, excelButtonConfig, addOptions);
                        excelButtonConfig.action.call(ths,e, dt, button, excelButtonConfig);
                    }).draw(false);

                }
               }
             ]
          }).container().appendTo(<the button>);

Nothing worked for me so far.

Yazid Erman
  • 1,166
  • 1
  • 13
  • 24
  • 1
    Sounds like you want to use the `messageBottom` as shown in this [example](https://datatables.net/extensions/buttons/examples/html5/titleMessage.html). – K Thorngren Feb 03 '18 at 12:07
  • Looks promising, I will try it, but do you know if it supports HTML content to play with the message style, or only text. – Yazid Erman Feb 04 '18 at 12:52

0 Answers0