I have two jQuery datatables on the same ascx page. I'm trying to insert a hyperlink into the toolbar div, which calls a link in the code behind, after the table has been rendered. Here's the code:
var SDFtable = $('#tblSDF').dataTable(
{
"scrollY": "300px",
"scrollX": true,
"scrollCollapse": true,
"paging": false,
"autowidth": true,
dom: '<"toolbar"><"filterPad"f>rti<"floatRight"B><"clear">',
//all available button options
//'copy', 'csv', 'excel', 'pdf', 'print'
buttons: {
buttons: [
{ extend: 'excel', text: 'Download this grid in Excel', exportOption: { page: 'current' }, footer: true }
]
}
});
$("div.toolbar").html('<h2><a id="aSDFExport" title="Click here to download full report" OnServerClick="ExportFundingSummaryToExcel" runat="server">SDF Pool</a></h2>');
The problem is that I have two of these blocks of code, one for each table, and when the second $("div.toolbar") line runs, it adds that link to both datatables. How can I reference that specific to the table that is being drawn?
Thanks in advance.
#tblSDF?