on 2018 Mar 30 2:53 PM
Hi,
how do I create a new entity with oData V4 model without having an existing ListBinding?
I have a SimpleForm and want to create a new entity based upon the entered information.
So I tried to manually create a ListBinding as this seems to be the only way to create a new enitty via create() method.
var oListBinding = oModel.bindList("/Templates");
var oContext = oListBinding
.create({"id":"1"});
But nothing is being sent to the backend.
What am I doing wrong?
All examples I have found base upon a control being bound and used a syntax like this
var oListBinding = this.getView().byId("mainmenulist").getBinding("items");
var oContext = oListBinding
.create(oMainMenuItem);
Thanks
Request clarification before answering.
Hello Oliver,
could you explain to me how to create an entity with oData v4? If its possible without List binding, because i dont have a list. I use two input fields to create a new entity.
I have the same requirement as above, could you please let me know if there are any ways to achieve this ? In my case i have FeedInput, User allowed to enter the comment and post it , upon posting the comment shd get saved in the entity and we are using V4 version..
Thanks in advance,
Pradeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Pradepp,
you must create a list object in your code via:
const oListBindingVehicle = this.getView().getModel("kddietz").bindList("/Vehicle");
On these reference, you can call the function "create".
oListBindingFahrzeug.create(oVehicleDataJson, true);
In the meantime there is also a related blog post: https://blogs.sap.com/2022/06/07/ui5-odatamodel-v4-vs-v2-custom-odata-requests/.
User | Count |
---|---|
96 | |
11 | |
9 | |
9 | |
7 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.