mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
fix dynamic table validation (#1741)
- dynamic table widget no longer creates a copy of field model, but uses original one, fixes the problem with validation and state management - update unit tests
This commit is contained in:
committed by
Eugenio Romano
parent
d32ed969a7
commit
44808a31a3
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { FormWidgetModel } from './../core/form-widget.model';
|
||||
import { FormModel } from './../core/form.model';
|
||||
import { FormFieldModel } from './../core/form-field.model';
|
||||
import * as moment from 'moment';
|
||||
|
||||
@@ -50,19 +49,19 @@ export class DynamicTableModel extends FormWidgetModel {
|
||||
}
|
||||
}
|
||||
|
||||
constructor(form: FormModel, json?: any) {
|
||||
super(form, json);
|
||||
constructor(field: FormFieldModel) {
|
||||
super(field.form, field.json);
|
||||
this.field = field;
|
||||
|
||||
if (json) {
|
||||
this.field = new FormFieldModel(form, json);
|
||||
if (field.json) {
|
||||
|
||||
if (json.columnDefinitions) {
|
||||
this.columns = json.columnDefinitions.map(obj => <DynamicTableColumn> obj);
|
||||
if (field.json.columnDefinitions) {
|
||||
this.columns = field.json.columnDefinitions.map(obj => <DynamicTableColumn> obj);
|
||||
this.visibleColumns = this.columns.filter(col => col.visible);
|
||||
}
|
||||
|
||||
if (json.value) {
|
||||
this.rows = json.value.map(obj => <DynamicTableRow> {selected: false, value: obj});
|
||||
if (field.json.value) {
|
||||
this.rows = field.json.value.map(obj => <DynamicTableRow> {selected: false, value: obj});
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user