I am using the angular datatables module in my project and i configured a function using the rowrollback function to perform actions when clicked on the row. but when using that i can't click on buttons in my row, like actions designed for each row (e.g delete modify client ).
I tried not to add the Actions column in my dtconfig object but it made my datatable not get triggered.
here is my code :
dtOptions :
dtOptions = {
pagingType: 'full_numbers',
pageLength: 10,
columns: [{
title: 'Current Owner',
data: 'CurrentOwner'
},{
title: 'Doc Hash',
data: 'hash'
},{
title: 'Doc Name',
data: 'name'
},{
title: 'Doc Owner',
data: 'DocumentOwner'
},{
title: 'Time Stamp',
data: 'Timestamp'
},{
title: 'Actions',
data: 'actions'
}],
rowCallback: (row: Node, data: Object |any[] , index: number) => {
try{
const self = this;
// Unbind first in order to avoid any duplicate handler
// (see https://github.com/l-lin/angular-datatables/issues/87)
$('td', row).unbind('click');
$('td', row).bind('click', () => {
let X ={};
Object.assign(X,data);
console.log(X)
console.log(this.Certificates[index]);
self.DetailedCertificate=this.Certificates[index];
$(this.detailRef.nativeElement);
$(this.detailRef.nativeElement).modal("show");
});
return row;
}
catch (e){
console.error("error"+e);
}
}
HTML Table :
<tr *ngFor="let row of dataRows" class=".row" >
<td style="text-overflow: ellipsis; overflow-wrap: break-word">{{row.CO}}</td>
<td>{{row.KC}}</td>
<td>{{row.DocName}}</td>
<td>{{row.DocOwner}}</td>
<td>{{row.TimeStamp}}</td>
<td class="text-right">
<button class="btn btn-lg btn-simple btn-info btn-icon" (click)="CO(row.KC,row.DocOwner)"><i class="material-icons">person_pin_circle</i></button>
<button class="btn btn-lg btn-simple btn-danger btn-icon" (click)="RC(row.KC,row.DocOwner)"><i class="material-icons">close</i></button>
</td>
</tr>