Unable to call save method in Breeze controller

49 views Asked by At

I am working on Single Page application using Durandal framework. I want to call save method explicitly from Breeze controller. So to call save method explicitly, I was trying to set entity state modified in below way, but still I am unable to call save method in Breeze controller.

SelectedModelData().Model.entityAspect.entityState.name = "Changed";
SelectedModelData().Model.entityAspect.entityState.isModified = true;

SelectedModelData() is observable. And Model is entity inside that observable.

1

There are 1 answers

0
Steve Schmitt On

The EntityState values are like Enums, so you can't just change the name. The correct way is:

SelectedModelData().Model.entityAspect.setModified();

or

SelectedModelData().Model.entityAspect.setEntityState(breeze.EntityState.Modified);

See http://breeze.github.io/doc-js/inside-entity.html#EntityState for more info.