So, I cannot seem to find an answer anywhere about this.
I was trying to use this the "Server way" which works great, until you find out the limitations. Like the "select" plugin does not work, or you cant use "expanding" tables
So, I need to go back to using Datatable natively.
Let's say I define my table like this
this.dtOptions = {
ajax: (dataTablesParameters: any, callback: any) => {
this.myService.myEndPoint(dataTablesParameters).
subscribe((resp: any) => {
this.attributes = resp.aaData;
callback({
recordsTotal: resp.iTotalRecords,
recordsFiltered: resp.iTotalDisplayRecords,
data: resp.aaData
});
});
},
select: true,
order: [2, "asc"],
columns: [{
data: null,
defaultContent: 'details',
orderable: false,
class: 'details-control'
},
{
data: null,
orderable: false,
},
{
data: "skuPartNumber",
orderable: true,
},
{
data: "activeUnits",
orderable: true
},
//{ data: "consumedUnits", orderable: true }
{
title: "Display Name",
data: null,
orderable: true,
render: (data, type, full) => `<button (click)="testClick(data.id)">sdfsdf</button>`
}
]
};
How can I listen for the button event? My assumption is the page is rendered (compiled) before the AJAX and data table completes?
I was able to do this in knockoutJS and durandal, but cannot figure this out in Angular