This commit is contained in:
Gerard 2018-10-30 15:08:19 +01:00
parent 961f4a30cc
commit b318386318
1 changed files with 9 additions and 6 deletions

View File

@ -144,7 +144,7 @@ export default class CrudModel extends ModelProxy {
for (let row of this.removed) for (let row of this.removed)
remove.push(row.$orgRow[pk]); remove.push(row.$orgRow[pk]);
for (let row of this._data) { for (let row of this._data)
if (row.$isNew) { if (row.$isNew) {
let data = {}; let data = {};
for (let prop in row) for (let prop in row)
@ -160,7 +160,6 @@ export default class CrudModel extends ModelProxy {
where: {[pk]: row.$orgRow[pk]} where: {[pk]: row.$orgRow[pk]}
}); });
} }
}
let changes = { let changes = {
create: create, create: create,
@ -184,7 +183,10 @@ export default class CrudModel extends ModelProxy {
let url = this.saveUrl ? this.saveUrl : `${this._url}/crud`; let url = this.saveUrl ? this.saveUrl : `${this._url}/crud`;
return this.$http.post(url, changes) return this.$http.post(url, changes)
.then(() => this.applyChanges()); .then(() => {
this.applyChanges();
super.save();
});
} }
buildParams() { buildParams() {
@ -220,9 +222,9 @@ export default class CrudModel extends ModelProxy {
onRemoteDone(json, filter, append) { onRemoteDone(json, filter, append) {
let data = json.data; let data = json.data;
if (append) { if (append)
this.orgData = this.orgData.concat(data); this.orgData = this.orgData.concat(data);
} else { else {
this.orgData = data; this.orgData = data;
this.currentFilter = filter; this.currentFilter = filter;
} }
@ -267,6 +269,7 @@ ngModule.component('vnCrudModel', {
userFilter: '<?', userFilter: '<?',
userParams: '<?', userParams: '<?',
primaryKey: '@?', primaryKey: '@?',
autoLoad: '<?' autoLoad: '<?',
autoSave: '<?'
} }
}); });