Issue
`<ngx-datatable-column *ngIf="search_type ==='booking'" [width]="50" [sortable]="false"
[canAutoResize]="false" [draggable]="false" [resizeable]="false">
<ng-template ngx-datatable-cell-template let-row="row" let-value="value">
<span class="fa fa-user-plus font-medium-3 text-primary cursor-pointer pl-1"
(click)="onUpdateBookingLinguist(row)"></span>
</ng-template>
</ngx-datatable-column>`
Above is my html code and below is my ts code
` onUpdateBookingLinguist(linguist: Linguist) {
const modalRef = this.modalService.open(ScheduledBookingModalComponent, { size: 'lg' });
modalRef.componentInstance.linguist_other_bookings = linguist['scheduled_booking'];
modalRef.result.then((result) => {
if (!result) {
return;
}
this.cdr.detectChanges();
}).catch((e) => { });
this.cdr.detectChanges();
}`
I am trying to open the modal from ngx-datatable-column but getting this error
ERROR Error: NG0100: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'datatable-body-cell sort-active active'. Current value: 'datatable-body-cell sort-active'.. Find more at https://angular.io/errors/NG0100
I have tried manually triggering change detection using ChangeDetectorRef.detectChanges() but still getting the error.
Solution
I have fixed this problem by changing span into the button and now it's working fine.
<ngx-datatable-column *ngIf="search_type ==='booking'" [width]="50" [sortable]="false"
[canAutoResize]="false" [draggable]="false" [resizeable]="false">
<ng-template ngx-datatable-cell-template let-row="row" let-value="value">
<button (click)="onUpdateBookingLinguist(row)" class="btn btn-sm btn-for-add-linguist font-medium-3"><i class="fa fa-user-plus"></i></button>
</ng-template>
</ngx-datatable-column>
Answered By - Smith
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.