Buttons - customize option

Buttons - customize option

rodriformigarodriformiga Posts: 30Questions: 7Answers: 0
edited February 2018 in Free community support

Hello @allan

Please, I would like to improve the documentation and standardization of the customize method, of export buttons. I checked the code, and in some places the window is simply passed, as in the case of the print, in others the configuration is sent, according to the pdf, and so on.
Would be nice if there was a property with the DataTables.Api or the config, so that inside the config function I can read some data from the datatable and apply the required customization.

To understand: I Have a custom print button:

$.fn.dataTable.ext.buttons.imprimir = {
    extend: "print"
  , name: "imprimir"
  , text: 'Imprimir'
  , exportOptions: { stripHtml: false //para grids com ícone
                   , columns: ":not(.tdAct)" //ignora colunas de acção 
  , title: $.fn.dataTable.ext.buttons.fnTitleExp
  , autoPrint: false
  , customize: function( win ) {
      console.log("print", this, win);
      var tab = $(win.document.body).find("table");
      tab.find("tr td:nth-child(3)").addClass( "dt-body-right" );

and I use this button in many tables in my system. Inside my customize, I don't have the name of the table or any Datatable scope....

This question has an accepted answers - jump to answer


Sign In or Register to comment.