my-monty-dynamic-table
v0.0.9
Published
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.1.0.
Downloads
7
Readme
MyMontyDynamicTable
This library was generated with Angular CLI version 14.1.0.
How to use
app.component.html
<myMonty-Dynamic-Table
[actions]="actions"
[showError]="isError"
(action)="onTableAction($event)"
[multipleRowActions]="multipleRowActions"
(onDelete)="onDelete($event)"
(onPrint)="onPrint($event)"
(onExportExcel)="onExportExcel($event)"
(onExportPdf)="onExportPdf($event)"
(onAdd)="onAdd($event)"
[showTotalPages]="10"
[pageSize]="5"
[dataset]="data"
[columns]="columns">
</myMonty-Dynamic-Table>
app.component.ts
isError = false;
constructor(private http: HttpClient) { }
columns = [
{ columnDef: 'description', header: 'Title' },
];
actions = ['view','edit','delete'];
multipleRowActions = ['delete','print','exportExcel','exportPdf','add']
data = new BehaviorSubject([]);
ngOnInit() {
this.getData()
}
getData():any{
this.http.get<any[]>("http://localhost:1555/api/v1/categories").subscribe((res:any)=> {
this.data.next(res);
});
}
onTableAction(event: any) {
console.log('event', event)
}
onDelete(event: any){
console.log('event', event)
}
onPrint(event: any){
console.log('event', event)
}
onExportExcel(event: any){
console.log('event', event)
}
onExportPdf(event: any){
console.log('event', event)
}
onAdd(event: any){
console.log('event', event);
//this.getData();
}
ngOnDestroy(): void {
if(this.data) {
this.data.unsubscribe();
}
}