akveo / akveo/ng2-smart-table

Display the button action (edit, delete)

Open
#1,088 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.6k
Forks
867
PR merge metrics
No merged PRs in 30d

Description

Hi everyone,

Maybe someone can help me, I just want to know how to display the button action (edit, delete) only for some brands.
For example, as you can see on this screen capture, if the brands is Peugeot i doesn't want to display the button action.

ID | User | Marque | Actions

1 | Bret Litt  | Citroen | EditDelete
2 | Ervin Paula | Citroen | EditDelete
3 | Ervin Howell | Peugeot | EditDelete
4 | Erica Howell | Peugeot | EditDelete
5 | Ervin Howell | Citroen | EditDelete

html
`

`

.ts

`import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-table',
templateUrl: './table.component.html',
styleUrls: ['./table.component.css']
})
export class TableComponent implements OnInit {
data: any;
settings: any;
constructor() { }

ngOnInit() {

this.settings = {
actions: {
add: true,
edit: true,
delete: true,
custom: [{ name: 'ourCustomAction', title: '' }],
position: 'right'
},
columns: {
id: {
title: 'ID',
filter: false,
},
name: {
title: 'User',
filter: false,
},
marque: {
title: 'Marque',
filter: false,
}
}
};
this.data = [
{
id: 1,
user: "Leanne Graham",
marque: "Bret",
},
{
id: 2,
name: "Ervin Paula",
marque : "Citroen",
},
{
id: 3,
name: "Ervin Howell",
marque : "Peugeot",
},
{
id: 4,
name: "Erica Howell",
marque : "Peugeot",
},
{
id: 5,
name: "Ervin Howell",
marque : "Citroen",
}
];
}

}
`

thanks !!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.