Changing entity doesn't refresh the dependent fields (custom controls)
Hello!
I followed the example of Angular Material and customized the component using the Telerik Kendo library. However, I encountered a problem related to entity mode. Changing entity does not refresh the dependent fields. I get the following error in the console:
After digging through the source code it looks like "changeEntity" function binded to onChange doesn't get all parameters: "index : number" and "data : RuleSet". I checked the example of Angular Material and the error also occurs there.
If you don't use validation rules, you can remove the onChange and let the ngModel do the job :
<ng-container *queryEntity="let rule; let entities=entities;">
<mat-form-field>
<mat-select *ngIf="rule" [(ngModel)]="rule.entity">
<mat-option *ngFor="let entity of entities" [value]="entity.value">
{{entity.name}}
</mat-option>
</mat-select>
</mat-form-field>
</ng-container>
<ng-container *queryField="let rule; let fields=fields;let getFields = getFields">
<mat-form-field>
<mat-select [(ngModel)]="rule.field">
<mat-option *ngFor="let field of getFields(rule.entity)" [value]="field.value">
{{ field.name }}
</mat-option>
</mat-select>
</mat-form-field>
</ng-container>
If you don't use validation rules, you can remove the onChange and let the ngModel do the job :
<ng-container *queryEntity="let rule; let entities=entities;"> <mat-form-field> <mat-select *ngIf="rule" [(ngModel)]="rule.entity"> <mat-option *ngFor="let entity of entities" [value]="entity.value"> {{entity.name}} </mat-option> </mat-select> </mat-form-field> </ng-container> <ng-container *queryField="let rule; let fields=fields;let getFields = getFields"> <mat-form-field> <mat-select [(ngModel)]="rule.field"> <mat-option *ngFor="let field of getFields(rule.entity)" [value]="field.value"> {{ field.name }} </mat-option> </mat-select> </mat-form-field> </ng-container>
Hi ACivilise, On removal of onChange it does not show error rules undefined but Changing entity does not refresh the dependent fields.