Tabletools copy/export not working for checkbox rendered column
Tabletools copy/export not working for checkbox rendered column
crush123
Posts: 417Questions: 126Answers: 18
i have a datatable which is rendering 1 and 0 values as checkboxes.
everything works fine, but if i want to copy/export with tabletools, the rendered column is ignored (print is ok)
so if i have
{ data: "tblorders.PaymentBanked" ,
render: function ( data, type, row ) {
return data;
},
className: "dt-body-center"
},}
The copy export is ok, but if i have
{ data: "tblorders.PaymentBanked" ,
render: function ( data, type, row ) {
if ( type === 'display' ) {
return '<input type="checkbox" class="editor-tblorders_PaymentBanked" disabled="disabled">';
}
return data;
},
className: "dt-body-center"
}
the column is ignored.
As a side issue, is it possible to export unrendered data to excel, so for example data which is rendered on screen as currency, just to export as a number ?
thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
So the problem here is that the
display
option of your render method is returning HTML, but since HTML isn't all that useful in the exported files, TableTools will strip the HTML - hence why it looks like you get nothing!What you really want, I think here, is to remove the
display
parameter passed in on this line if you are using a local version of TableTools.I'm working on a rewrite of this functionality at the moment and plan to make this option configurable!
Regards,
Allan
That helps, but unfortunately gives me no fine control.
Also means that concatenated field such as firstname + lastname is rendered as [object Object] in excel.
will try and come up with a different workaround
Thanks
using the sample on
http://www.datatables.net/extensions/tabletools/button_options
I created hidden duplicate columns with unrendered content in my datatable, and used mColumns to determine which columns to export
;-)
Nice work around :-)
The new Buttons extension will give the option to define a custom orthogonal data request - so you could request
export
data for example.Allan