How call Datatable csv button from custom button

197
August 05, 2017, at 07:22 AM

Need to call csv button from my custom button.

<button value="Export report to Excel" class="button-default datatable-csv" type="button" id="ExportReporttoExcel">
                <span>Export report to Excel</span>
            </button>

Instead of calling it from the Datatable button, i want the same functionality from the above button.

How to make it.

Answer 1

If you are trying to trigger the click event of another button and you are using jQuery (according to your tags), you can use

<button onclick="$('#ExportReporttoExcel').click()">Click me</button>

This selects the element with the id "ExportReporttoExcel" and triggers a click with using jQuery.

READ ALSO
AJAX Strategy for Running Tasks in Order

AJAX Strategy for Running Tasks in Order

I have an API call which returns a list of building departments in orderOn the success of the call, a second API call is made to retrieve the hours of each department

121
Fastest way to template and append elements from array

Fastest way to template and append elements from array

Using jQuery and Javascript, I am building a chatbox from an array of messagesMy current setup is something similar to this:

148
jQuery JSON API IP not working

jQuery JSON API IP not working

Hi I'm trying to use jQuery to call JSON API info on geolocation, this is my code:

223
Speed up wheel scroll based event

Speed up wheel scroll based event

I have a custom script which advances a small icon upon wheel scrollIt works well but it's not advancing the element as quickly as I would like

170