on 2016 Apr 24 2:24 PM
I am trying to use Two-Way binding with a v2 OData model. In the route matched of the create view I have the following code.
this.getOwnerComponent().oWhenMetadataIsLoaded.then(function() {
var oEntry = oView.getModel().createEntry("/ContactCollection");
oView.setBindingContext(oEntry);
}.bind(this));
}.bind(this));
At runtime i call the screen and update a value in the create view that is "bound" to the model.
Then in my save function I have been executing the following line in the debugger.
this.getView().getBindingContext().getObject()
The output is a blank entity will all properties set to "undefined".
While searching I found this page
So i implemented line
oView.getModel().setDefaultBindingMode(sap.ui.model.BindingMode.TwoWay);
in the route matched function above with same results.
I have also tried using
oView.unbindElement();
from the discussion here
Any help would be appreciated.
Request clarification before answering.
Did you try setting the model's default binding mode when it was created instead of in the view?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This worked. I passed in the default binding mode on create to be set to TwoWay using the documentation found here.
Not sure why the function call did not work.
how you store the model? with name?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I did. When I tried it it looked like.
this.getOwnerComponent().oWhenMetadataIsLoaded.then(function() {
oView.getModel().setDefaultBindingMode(sap.ui.model.BindingMode.TwoWay);
var oEntry = oView.getModel().createEntry("ContactCollection");
oView.setBindingContext(oEntry);
});
}.bind(this));
But still did not work
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.