Add new record (dynamic table)

This commit is contained in:
Denys Vuika
2016-10-21 17:16:04 +01:00
committed by Vito Albano
parent 51102980df
commit 36dd42b62d
4 changed files with 26 additions and 5 deletions

View File

@@ -70,7 +70,11 @@ export class DynamicTableWidget extends WidgetComponent implements OnInit {
addNewRow() {
if (this.content) {
this.editRow = <DynamicTableRow> { selected: false, value: {} };
this.editRow = <DynamicTableRow> {
isNew: true,
selected: false,
value: {}
};
this.editMode = true;
}
}
@@ -92,7 +96,10 @@ export class DynamicTableWidget extends WidgetComponent implements OnInit {
onSaveChanges() {
if (this.content) {
if (this.editRow.isNew) {
// TODO: create new record
let row = this.copyRow(this.editRow);
this.content.selectedRow = null;
this.content.addRow(row);
this.editRow.isNew = false;
} else {
this.content.selectedRow.value = this.copyObject(this.editRow.value);
}