Hi,
I have a Column where I defined a <ng-template> in edit mode like this:
When I enter in edit mode on child grid, the function actionBegin exec this:
So, this.measureQty contain the value that I want bind, but the value not appears.
What am I doing wrong?
Thanks
<ng-template #editTemplate let-data>
<ejs-textbox id="CustomerID" [(ngModel)]="customVal" placeholder="Enter value" cssClass="e-outline"></ejs-textbox>
</ng-template> |
import { Component, Inject, OnInit, ViewChild, ViewContainerRef, ViewEncapsulation } from '@angular/core';
export class AppComponent {
@ViewChild('editTemplate', { static: true }) public editTemp: any;
public customVal;
constructor(@Inject(ViewContainerRef) private viewContainerRef?: ViewContainerRef) {
}
ngAfterViewInit() {
this.editTemp.elementRef.nativeElement._viewContainerRef = this.viewContainerRef;
this.editTemp.elementRef.nativeElement.propName = 'template';
}
ngOnInit(): void {
this.childGrid = {
load() {
// Set registertemplate value as empty in load event
this.registeredTemplate = {};
},
columns: [
...
{ field: 'CustomerID', headerText: 'Customer ID', editTemplate: this.editTemp},
],
actionBegin: (args) => {
if (args.requestType === 'beginEdit' || args.requestType === 'add') {
this.customVal = args.rowData['CustomerID'];
}
if (args.requestType === 'save') {
args.data['CustomerID'] = this.customVal;
}
}
};
}
} |