我正在使用下面的图书馆来我的角16项目。
[https://l-lin.github.io/angular-datatables/#/welcome][1]
这是我的职责
yes() {
this.dtOptions = {
pagingType: 'simple_numbers',
serverSide: true,
pageLength: 5,
dom: 'rtip',
ajax: (dataTablesParameters: any, callback) => {
const headers = new HttpHeaders({
'user': '[email protected]' // Replace with the actual username
});
dataTablesParameters.start = dataTablesParameters.start || 0;
dataTablesParameters.length = dataTablesParameters.length || 10;
this.http
.post<DataTablesResponse>(
'http://10.183.84.30:8080/aqpp/getsSpecialistList',
dataTablesParameters, { headers }
)
.subscribe((resp: DataTablesResponse) => {
callback({
data: resp.data,
recordsTotal: resp.recordsFiltered,
recordsFiltered: resp.recordsFiltered,
});
});
},
columns: [
{
title: 'ID',
data: 'id'
},
{
title: 'Query Subject',
data: 'querySubject'
},
{
title: 'Actions',
orderable: false, // Make the column not sortable
data: null,
defaultContent: '<button class="edit-button">Edit</button>'
}
]
};
}
我尝试为每一列添加操作按钮,当我单击它时,我需要将行数据传递给按钮函数。上述功能不起作用。按钮并没有出现。
这是我的HTML
<table datatable [dtOptions]="dtOptions" class="table table-striped border" style="width: 100%;"></table>