3

I try to do dynamically change filename and change other variable after click export button. But it seem the new release got problem inside button.html5.js. Can anyone help me with this thing. Here is the error image and the link of my code.

enter image description here

buttons:    [{
              extend: 'excel',
              text:   'Excel',
              action: function (e, dt, node, config) {
                        exportExtension = 'Excel';

                        $.fn.DataTable.ext.buttons.excelHtml5.action(e, dt, node, config);
                      }
               }]

JsFiddle

1 Answer 1

6

This is a scoping issue. The action method needs to be executed in the scope of the Buttons instance so it can access method attached to this. In this case you need to use:

$.fn.DataTable.ext.buttons.excelHtml5.action.call(this, e, dt, node, config);

See also this thread on the DataTables forums on the same topic with this answer and a working test case.

Allan

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.