skuid model save returns 'done' promise despite missing required field warning

Matt SonesMatt Sones 💎💎💎
edited December 7, 2016 in Questions
Hello Skuid!

I am calling skuid.model.save() in a snippet like so:
'saveAllSnippet': function () {
var modelsToSave = [],
modelsToExclude = ['AddTests','ProcessLog','ChangeTracker','ShowTabs','UI_Model','DefaultTo','ChartAudit'],
dfd = new $.Deferred(); $.each(skuid.model.map(), function(){
if (this.hasChanged && (modelsToExclude.indexOf(this.id) === -1) && this.preventUnloadIfUnsavedChanges) { modelsToSave.push(this); }
}); $.when(skuid.model.save(modelsToSave))
.done(function(){
console.log('All Models Saved.'); dfd.resolve(); })
.fail(function(){
console.log('All Model Save Failed.'); dfd.reject(); });
return dfd.promise();
}
As you can see from the image below, the .done() response is being called from $.when() despite the fact that the model is throwing a missing required field error.
image

Help?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!