I have the following grid stacked column
Cannot read properties of null (reading 'parentElement')
at FormValidator.getErrorElement (ej2-inputs.es2015.js:7312:34)
at FormValidator.validateRules (ej2-inputs.es2015.js:7180:1)
at FormValidator.validate (ej2-inputs.es2015.js:6843:1)
at BatchEdit.validateFormObj (ej2-grids.es2015.js:35762:1)
at BatchEdit.onBeforeCellFocused (ej2-grids.es2015.js:35559:1)
at Observer.notify (ej2-base.es2015.js:2325:1)
at GridComponent.notify (ej2-base.es2015.js:6785:1)
at FocusStrategy.onClick (ej2-grids.es2015.js:7390:1)
at Observer.notify (ej2-base.es2015.js:2325:1)
at GridComponent.notify (ej2-base.es2015.js:6785:1
Please help
|
<ejs-grid [dataSource]="data" [editSettings]='editSettings' [allowPaging]="true" [allowResizing]="true">
<e-columns>
<e-column
field="OrderID"
headerText="Order ID"
width="120"
textAlign="Center"
minWidth="10"
isPrimaryKey='true'
></e-column>
<e-column headerText="Order Details" width="140">
<e-stacked-columns>
<e-stacked-column
field="CustomerName"
headerText="Customer Name"
width="140"
[validationRules]="{'required': true}"
>
<ng-template #editTemplate let-data>
<input class="e-input" id="editTemplateInput" name="CustomerName" required [(ngModel)]="data.CustomerName" type="text" />
</ng-template>
</e-stacked-column>
<e-stacked-column
field="ShipCountry"
headerText="Ship Country"
width="140"
>
</e-stacked-column>
</e-stacked-columns>
</e-column>
<e-column headerText="Details" width="140">
<e-stacked-columns>
<e-stacked-column field="ShipCity" headerText="Ship Name" width="140">
</e-stacked-column>
<e-stacked-column field="OrderDate" headerText='Order Date' width='120' editType='datetimepickeredit' [format]='formatoptions' textAlign='Right' [validationRules]="{'required': true}">
</e-stacked-column>
</e-stacked-columns>
</e-column>
</e-columns>
</ejs-grid>
|
Hi Rajapandi,
Thanks for quick reply. I have forked from your sample to reproduce the issue. I can see the issue is when I try to dynamically bind input name
Please see the below sample
https://stackblitz.com/edit/angular-yukzoq-d4yb8f?file=app.component.html
|
<e-stacked-column
[field]="'Customer' + 'Name'"
headerText="Customer Name"
width="140"
[validationRules]="{ required: true }"
>
<ng-template #editTemplate let-data>
<input
class="e-input"
id="editTemplateInput"
[attr.name]="'Customer' + 'Name'"
required
[(ngModel)]="data.CustomerName"
type="text"
/>
</ng-template>
</e-stacked-column> |
This worked. Great thanks!