In my SAPUI5 app I'm using odata v4 model to communicate with the server. I have a detail view that binds to an existing object something like this:
// Controller code:
this.getView().bindElement({
path: "/Objects(" + this.m_ObjectId + ")",
model: "modelName"
});
If I want to create a new item in that view instead, I'm not binding to an existing item of course. From the documentation I saw that one should create new items like this:
var oModel = this.getModel("modelName");
var oListBinding = oModel.bindList('/Objects');
var oNewKap = oListBinding.create({
'OBJECT_ID': 0,
'SOME_PROP': 'Test'
});
The question now his, how to bind that newly created (transient) object to my view? If I do a
this.getView().bindElement({
path: "/Objects(0)",
model: "modelName"
});
The app will try to fetch an existing item from the server again...
Any help is appreciated!