I'm using ng2 smart column to show transactions which contain an user object. I want to display the id user, name, and email in different columns. How can I do it?
settings = {
add: {
addButtonContent: '<i class="nb-plus"></i>',
createButtonContent: '<i class="nb-checkmark"></i>',
cancelButtonContent: '<i class="nb-close"></i>',
confirmCreate : true
},
edit: {
editButtonContent: '<i class="nb-edit"></i>',
saveButtonContent: '<i class="nb-checkmark"></i>',
cancelButtonContent: '<i class="nb-close"></i>',
confirmSave : true
},
delete: {
deleteButtonContent: '<i class="nb-trash"></i>',
confirmDelete: true,
},
columns: {
id: {
title: 'ID',
type: 'number',
},
user: {
title : 'name',
valuePrepareFunction: (data) => {
return data.email;
},
},
amount: {
title: 'Valeur',
type: 'number',
},
items: {
name: { title: 'Nom' },
},
state: {
title: 'Etat',
type: 'string',
},
delivery_date: {
title: 'Date de livraison',
type: 'string',
},
expedition_date: {
title: 'Date d\'expedition',
type: 'string',
},
},
};
check it on this link https://stackblitz.com/edit/example-ng2-smart-table-ytzrns?file=src/app/app.component.ts
this is the solution