Buttons - customize option
Buttons - customize option
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
Answers
PS: I researched again, and only in the buttons
excel
andprint
is not passed theconfig
Sounds like a very good plan to me - thanks for the suggestion! I've committed the changes needed and they will be in the next release version.
Regards,
Allan
Thanks @allan