Change Buttons exportsOptions dynamically

Change Buttons exportsOptions dynamically

AGILTECHAGILTECH Posts: 2Questions: 1Answers: 0

I'd like to change the displayed columns of an export dynamically.
I have 20 columns in my table and can select differents layout.
I can export exactly what is displayed by using exportOptions column : ':visible' and that works perfectly.

But I need to do some changes to the export according to the currently displayed layout.
For instance it's required that while displaying column 1 / 2 / 5 /12 I'll export 1 / 2 / 6/7/ 8 / 12. (so to substitute the column 5 by columns 6/7/8).

I can calculate the index needed and want to update the button export option property. I've tried

table.button(0)[0].inst.c.buttons[0].exportOptions = {columns: [4,5,6]}

But this doesn't reflect in the exported data.

Any Idea or method I missed ?

This question has an accepted answers - jump to answer


  • kthorngrenkthorngren Posts: 10,638Questions: 25Answers: 2,428
    edited April 27 Answer ✓

    table.button(0)[0].inst.c.buttons[0].exportOptions = {columns: [4,5,6]}

    I don't believe dynamically updating the exportOptions this way is going to work. This example states the the column-selector can be used. There are lots of options. You can use a class and update the class of the columns you want to export. You can use a function which, I think, would be more like what you are trying to do.


  • AGILTECHAGILTECH Posts: 2Questions: 1Answers: 0

    Thank you very much, I missed that possibility.

Sign In or Register to comment.