I am currently using ng2-smart-table and have implemented a custom filter with the same button in both filters. However, I am unsure of how to determine which button is being clicked.
https://i.stack.imgur.com/b1Uca.png
Below is the component code for the button:
@Component({
template: `
<button (click)="onClick()">Select Range</button>
`,
})
export class RangeFilterComponent extends DefaultFilter implements OnInit {
inputControl = new FormControl();
constructor(private dialogService: NbDialogService) {
super();
}
ngOnInit() {
}
onClick=()=>{
this.dialogService.open(ShowcaseDialogComponent, {
context: {
title: 'Select Range',
},
});
}
}
Here are the ng2-smart-table settings where I have rendered the button:
columns: {
name: {
title: 'Project Name',
type: 'string',
},
description: {
title: 'Description',
type: 'string',
},
type: {
title: 'Project Type',
type: 'string',
},
scheme: {
title: 'Scheme',
type: 'string',
},
assigned_to: {
title: 'Engineer',
type: 'string',
},
assigned_contractor: {
title: 'Contractor',
type: 'string',
},
cost_disbursement: {
title: 'Cost Disbursement',
filter:{
type: 'custom',
component: RangeFilterComponent
}
},
physical_progress: {
title: 'Physical Progress',
filter:{
type: 'custom',
component: RangeFilterComponent
}
},