jQuery DataTables TableTools Export - get values of checkboxes or radio items
jQuery DataTables TableTools Export - get values of checkboxes or radio items
I am using TableTools v2.2.2 and DataTables 1.10.0 and have it successfully exporting some table contents. However, it is not picking up the values from the checkboxes in the table cells. How can I extract the value as true or false (or 1,0; any indicator really) from the cells and make them export?
Here is my JSFiddle for the problem.
http://jsfiddle.net/razzledazzle/e8brzc6c/4/
Other people have asked the same question, but with no response:
http://w.datatables.net/forums/discussion/23388/using-fncellrender-before-exporting-to-pdf
http://datatables.net/forums/discussion/14328/table-tools-doesn-t-export-pdf-using-fncellrender-and-tabs
http://www.datatables.net/forums/discussion/23550/jquery-datatables-tabletools-export-get-values-of-checkboxes-or-radio-items#latest - mine in the free forum.
You can see I've been trying to use fnCellRender and its anoynmous method, but even though I expect it to return " TableTools" for each cell, it returns nothing.
Thanks, Rhys
This question has an accepted answers - jump to answer
Answers
Using
fnCellRender
is the correct thing to do - however you need to extend a button type (sExtends
) and use the function there, like in the code example forfnCellRender
. Its a little bit of a pain at the moment, but you need to define that function for each button (although obviously you could define it once and then attach it to each button).Allan
Isn't this what I've already done:
Ah I see. Sort of. You've got the cell renderer at the rendered for the collection button. but the other buttons in the collection do not inherit that property. You need to specify it for them as well (actually it is completely redundant on
fnCellRender
since it is never used there).The planned rewrite of TableTools will include inheritance.
Allan
I have successfully done so by NOT using a collection. However, how can I code it to work with the Exports collection?
Exactly the same, just extend the buttons in the collection.
Allan
Perfect. Thanks very much.