cancel
Showing results for 
Search instead for 
Did you mean: 

Two-Way Binding with createEntry SAPUI5

04-24-2016 3:24 PM
4367 views 6 comments Go to solution
0 Likes
SAP Managed Tags
Subscribe

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.

0 Likes
View Entire Topic
Former Member
0 Likes
  1. oView.getModel().setDefaultBindingMode(sap.ui.model.BindingMode.TwoWay); 


Did you try setting the model's default binding mode when it was created instead of in the view?


0 Likes

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.