Hi, we have a master-detail list that in itself works fine.
We also have a separate “import” MatDialog that can be used to set the data of the master-detail list.
The import works fine and the master-detail data array gets replaced, but if the master-detail list is empty when importing, then the view is not updated until the browser window is resized (and then it shows the imported data).
Do you have any idea why this happens? I suspect the ngIf and ngFor directives in the master.ts template are not reevaluated for some reason.
Is there a better way to achieve the desired “replace data array” effect?
We use jsonforms 2.4.1
our schema.json:
{
"type": "object",
"definitions": { ... }
"properties": {
"privilegeGroups": {
"type": "array",
"items": {
"$ref": "#/definitions/privilegeGroup"
}
}
}
}
our uischema.json:
{
"type": "HorizontalLayout",
"elements": [
{
"type": "ListWithDetail",
"scope": "#/properties/privilegeGroups",
"options": {
"labelRef": "#/properties/name",
"detail": {
"type": "VerticalLayout",
"elements": [ ... ]
}
...
the MatDialog code:
dialogRef.afterClosed().subscribe(result => {
this.input = result;
if (this.input != null) {
this.backend.import(this.input)
.subscribe(
imported => {
if (!imported.errorMessage) {
this.jsonFormsService.updateCore(Actions.update('privilegeGroups', data => imported.privilegeGroups));
this.showSuccess();
} else {
this.showFailure(imported.errorMessage);
}
});
}
}
[original thread by Tue Toft Nørgård]