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