0

I have a jquery datatable and I want to use datatable's export to excel feature. But I don't want to show export excel button of datatable instead of this, I want to show my own button and call datatable's export to excel function.

With below code I was able to export the excel sucessfully but as I said above I want to export the excel when user clicked my custom button.

$(document).ready(function () {
            var table = $('#example').DataTable({
            "paging": false,
            "info": false,
            searching: false,
            dom: 'Bfrtip',
            buttons: [
                {
                    extend: 'excelHtml5'
                }
            ]
            });
        });

I have added click handler using below thread button i don't ant to show datatble's export button. I want make those buttons invisible. How to call Datatable csv button from custom button

3
  • Add a click handler to your button and call the DataTable() function when the button is clicked. Commented Oct 6, 2020 at 0:43
  • Thanks for the quick reply kmoser. I have updated my question But still i can see the datatable's export buttons. Commented Oct 6, 2020 at 0:49
  • stackoverflow.com/questions/52166257/…. Alternately, add custom CSS to hide those elements. Commented Oct 6, 2020 at 0:56

0

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.