I have integrated the ng2 smart table.
In the action column I have displayed the edit and delete links.
I want to hide the delete and edit links depending on the column value. If the status is active the edit and delete links need to hided.
Below is my settings
settings = {
selectMode: 'multi',
mode: 'external',
hideSubHeader:true,
editable:false,
pager : {
display : true,
perPage:20
},
actions: { add: false, edit: true, delete:true, position:'right'},
edit: {
editButtonContent: '<i class="fa fa-pencil"></i>'
//mode: 'external'
},
delete: {
deleteButtonContent: '<i class="fa fa-trash" aria-hidden="true"></i>',
confirmDelete: true
},
columns: {
id: {
title: 'ID'
},
title: {
title: 'Title'
},
status: {
title: 'Status',
type: "html",
valuePrepareFunction: (value) => {
if(value == 'To be approved') {
return '<span class="unapproved">'+value+'</span>'
} else {
//actions.edit = false;
return '<span class="approved">'+value+'</span>'
}
}
}
}
};
This is the code that I have used
<ng2-smart-table id="ng2_smart" [settings]="settings" [source]="data" (edit)="onEdit($event)" (delete)="onDelete($event, content)" (custom)="onCustom($event)" (userRowSelect)="selectedData($event)"></ng2-smart-table>