mirror of
https://github.com/NaN-tic/sao-base.git
synced 2023-12-14 03:13:01 +01:00
Add force_reload on save and return reload promesse
This commit is contained in:
parent
d0a08c5b42
commit
768a22b905
11
src/model.js
11
src/model.js
|
@ -424,7 +424,10 @@
|
|||
has_changed: function() {
|
||||
return !jQuery.isEmptyObject(this._changed);
|
||||
},
|
||||
save: function() {
|
||||
save: function(force_reload) {
|
||||
if (force_reload === undefined) {
|
||||
force_reload = false;
|
||||
}
|
||||
var context = this.get_context();
|
||||
var prm = jQuery.when();
|
||||
var values = this.get();
|
||||
|
@ -443,7 +446,9 @@
|
|||
}
|
||||
prm.done(function() {
|
||||
this.cancel();
|
||||
this.reload();
|
||||
if (force_reload) {
|
||||
return this.reload();
|
||||
}
|
||||
}.bind(this));
|
||||
if (this.group) {
|
||||
this.group.written(this.id);
|
||||
|
@ -451,7 +456,7 @@
|
|||
if (this.group.parent) {
|
||||
delete this.group.parent._changed[this.group.child_name];
|
||||
prm = prm.done(function() {
|
||||
return this.group.parent.save();
|
||||
return this.group.parent.save(force_reload);
|
||||
}.bind(this));
|
||||
}
|
||||
return prm;
|
||||
|
|
|
@ -997,7 +997,7 @@
|
|||
if (delete_) {
|
||||
records.forEach(function(record) {
|
||||
if (record.group.parent) {
|
||||
prms.push(record.group.parent.save());
|
||||
prms.push(record.group.parent.save(false));
|
||||
}
|
||||
if (~record.group.record_deleted.indexOf(record)) {
|
||||
record.group.record_deleted.splice(
|
||||
|
@ -1307,7 +1307,7 @@
|
|||
record = selected_records[i];
|
||||
jQuery.extend(context, record.get_timestamp());
|
||||
}
|
||||
record.save().done(function() {
|
||||
record.save(false).done(function() {
|
||||
record.model.execute(attributes.name,
|
||||
[ids], context).then(process_action.bind(this))
|
||||
.then(reload_ids);
|
||||
|
|
Loading…
Reference in a new issue