Custom Toolbar Not Visible on Export

Custom Toolbar Not Visible on Export

johnsonjjohnsonj Posts: 16Questions: 4Answers: 0

We have created two custom toolbars in version 1.10 of Datatables

Our code looks like this:

  .DataTable({
      dom: '<"toolbar"><"toolbar2">Bfrtip',
      ...

     });

     $("div.toolbar").html('<b>THIS IS TOOLBAR!</b>');
     $("div.toolbar2").html('<b>THIS IS TOOLBAR2!'</b>');

When using buttons to export the report (print, pdf, excel, etc.) the toolbars are not included.

Is there a way to include the toolbars?

Answers

  • kthorngrenkthorngren Posts: 21,670Questions: 26Answers: 5,017
    edited February 18

    Datatables only exports the row data, header and footer of the table. You can customize the output. Possibly using one of the message options shown in this example will work. Or you will need to use the customize function of each button to place the toolbars into the exported document. See this PDF example . Look at the docs of the particular HTML5 export buttons that you are interested in for more info about the specific customize function for each button type. Also you can find other customization examples.

    Kevin

  • johnsonjjohnsonj Posts: 16Questions: 4Answers: 0
    edited February 19

    I created a test case but could not get the buttons to display for whatever reason. But essentially when I click the buttons to export the table, I need the custom toolbars to also be displayed. The examples you provided above helped me with a separate issue I was having but I am still unable to get those toolbars into the report when exported.

    https://live.datatables.net/revemoke/1/edit?html,js,output

  • kthorngrenkthorngren Posts: 21,670Questions: 26Answers: 5,017

    I used the Download Builder to generate the required include files for the export buttons to use in the test case. I added messageTop as a function, as shown in this example, to get the toolbars. I only updated the Print button.
    https://live.datatables.net/revemoke/2/edit

    Kevin

Sign In or Register to comment.