Exporting specific columns dynamically
Exporting specific columns dynamically
Hi,
We have a datatable directive in angularJs.
Our directive is initialized dynamically with both the data and meta-data.
If We're correct, the way to define which columns go to the print/csv/etc is either by hidding them, or by defining the buttonCommon.columns with the wanted buttons and then extending the wanted export button.
The problem is that:
1. We want some of the information that shows in the table not to go to the export.
2. We cannot defined the columns using the
buttonCommon.columns = $('#'+scope.id).DataTable().columns(':not(.notForPrint)');
because the datatable is not initiated yet (the buttons are part of the datatable options.
How can We overcome this?
Many thanks,
Yishay
This question has an accepted answers - jump to answer
Answers
I'm not sure I understand why you can't use the
:not()
class selector? If the columns have the appropriate class, why can't you just use the following?:The column selector is run when the export button is clicked, so it is at that point the selector would be resolved.
Allan
Hi Allan,
sorry, this is so obvious, I don't know how I missed it.
Thanks,
Yisahy