I am trying to Implement the Jquery Datatable in my Angular 2 Application
I could Render the Table in my html file as follows
<sa-datatable [options]="options" tableClass="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Action</th>
</tr>
</thead>
</sa-datatable>
In my component Oninit , I am Initialising my Table as following and adding two Buttons in the Action
ngOnInit() {
this.options = {
dom: "Bfrtip",
ajax: (data, callback, settings) => {
//My Service Call
},
columns: [
{ data: "result.id" },
{ data: "result.name" },
{
data: null, render: function (data, type, row) {
return '<button id="myButton" class="btn btn-primary editbutton" data-toggle="modal" title="1" data-target="#mymodal" (click)="custcatSelected(' + data.result + ')">Edit</button> / <button #myButton1 class="btn btn-danger deletebutton" (click)=deleteCustCat(' + data.result.id + ')>Delete</button>';
}
}
],
buttons: [
'copy', 'excel', 'pdf', 'print', 'colvis'
]
};
}
public custcatSelected(customercat) {
//Implemetation for Edit , where customercat is an object
}
public deleteCustCat(custcatId: string) {
//Implementation for Deleting
}
I am not able to Trigger these two events custcatSelected() and deleteCustCat().
I could understand that these events are not compiled by angular ,since its added dynamically . And i do not know how to make these events work
Any Work Around would be helpful Thanks.