Change Buttons exportsOptions dynamically

Change Buttons exportsOptions dynamically

AGILTECHAGILTECH Posts: 2Questions: 1Answers: 0

Hello,
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 ?
Thanks.
Mathieu

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,322Questions: 26Answers: 4,948
    edited April 2020 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.

    Kevin

  • AGILTECHAGILTECH Posts: 2Questions: 1Answers: 0

    Thank you very much, I missed that possibility.

This discussion has been closed.