我正在尝试创建自定义操作,但出了点问题,代码没有给我自定义操作按钮
我的设置,我在操作:
中添加了自定义按钮settings = {
actions: {
edit: false,
custom: [
{
name: 'routeToAPage',
title: `<i class="ion-person" title="Xem thông tin người nhận Giftcode"></i>`
}
],
},
add: {
addButtonContent: '<i class="ion-ios-plus-outline"></i>',
createButtonContent: '<i class="ion-checkmark"></i>',
cancelButtonContent: '<i class="ion-close"></i>',
confirmCreate: true
},
columns: {
stt: {
title: 'STT',
editable: false,
},
},
pager : {
display : true,
perPage: 10
}
};
我的Html代码:
<ba-card class="smart-table-container">
<ng2-smart-table
[settings]="settings"
[source]="source"
(deleteConfirm)="onDeleteConfirm($event)"
(custom)="onCustom($event)"
></ng2-smart-table>
</ba-card>
我的问题是什么?
谢谢!
答案 0 :(得分:2)
我试过这个。请仔细检查我的代码 source:LocalDataSource;
settings = {
columns: {
Status: {
title: 'Status'
, class: 'align-centerr'
},
FullName: {
title: 'Full Name'
},
JobTitle: {
title: 'Job Title'
},
Department: {
title: 'Department'
},
EmailAddress: {
title: 'Email Address'
},
MobilePhone: {
title: 'Mobile No'
},
},
actions: {
edit: false,
custom: [{ name: 'Edit', title: `<i class="fa fa-edit"></i>` },
{ name: 'Activate', title: `<i class="fa fa-toggle-on"></i>` },
{ name: 'Deactivate', title: `<i class="fa fa-toggle-off"></i>` }
],
},
delete: {
deleteButtonContent: '',
confirmDelete: true
},
add: null,
defaultStyle: false
,
rowClassFunction: (row) => {
if (row.data.Status === 'Inactive')
{
return 'success-table';
} else if (row.data.Status === 'Active') {
return 'warning-table';
}
}