在ng2-smart-table中,我需要有条件显示的“开始”或“结束”按钮。我怎样才能做到这一点? 我有一个条件如果是真的,那么我想显示“开始”按钮,如果它是假的,那么我想要显示“结束”按钮。另外,如果用户单击这些按钮,我需要执行某些操作。
tableSettings = {
actions: false,
columns: {
code: {
title: 'Code'
},
first_name: {
title: 'First Name'
},
last_name: {
title: 'Last Name'
},
email_id: {
title: 'Email'
},
start_time: {
title: 'Start Time',
type: 'date',
valuePrepareFunction: (date) => {
return this.renderDateTime(date);
}
},
end_time: {
title: 'End Time',
type: 'date',
valuePrepareFunction: (date) => {
return this.renderDateTime(date);
}
},
start: {
title: 'Start/End',
type: 'html',
valuePrepareFunction: (cell, row) => {
return `<button *ng-If="renderButton(row) === 'Start'" (click)="startTest()">Start</button>`;
}
}
}
};