Closed miguelleitevieira closed 6 years ago
I'm trying to use EventEmitter. I create the emit on button and add this: <ng2-smart-table [settings]="pricePlanSettings" [source]="pricePlanSource" (test)="test($event)"> But the event isn't catch. Some help?
You solved it???? what happened? I could make use of the solution.
Hi,
I created a custom button column on my table.
button: { title: null, type: 'custom', renderComponent: ButtonRenderComponent, defaultValue: null, editor: { type: 'custom', component: ButtonRenderComponent, }, },
import { Component, Input, OnInit } from '@angular/core'; import { ViewCell } from 'ng2-smart-table'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { TranslateService } from '@ngx-translate/core';
@Component({ template:
<button class="btn" [disabled]="object.disabled" [ngClass]="object.style" (click)="this.object.action()">{{object.name}}</button>
, })export class ButtonRenderComponent implements OnInit { public object; @Input() value;
}
And on the data object I'm setting some button configurations;
button: { name: this.translate.instant('TAG_BTN_CANCEL_DOWNGRADE'), style: "btn-danger", action: this.onCancelDowngrade, disabled: true, }
I want to call the function onCancelDowngrade when the user click on button. But the button don't recognize the function.
I need a thing like a event that trigger this function on main component.
Someone did this?
Thanks.