on 03-06-2017 9:16 AM
Hi,
I have a table with aggregation property item set as items="{path:'/trackerSet'}". The data is displayed fine on the table. Now i want to add a new row to this table.
Initial model binding in the init is as below:-
this.sServiceUrl = "proxy/_____/sap/opu/odata/SAP/ZEMPLOYEE_SRV/";
this.oModel = new sap.ui.model.odata.ODataModel(
this.sServiceUrl, true, "", "");
var oView = this.getView().setModel(this.oModel);
Can you please advice.
Regards,
Narayan
Hi,
Your JSON model in the view is bit different after this line
oModel.setData({modelData: vData});
Above line creates one more parent node with name as modelData and sets the JSON. Below is the final JSON data:
{
"modelData": {
"products": [{
"product": "Test1",
"supplier": "Supp1",
"price": "25"
}, {
"product": "Test2",
"supplier": "supp2",
"price": "26"
}]
}
}
Change table binding to this...
<Table id="idProductsTable" inset="false"
items="{path: '/modelData/products'}">
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Narayan,
Add a add button to the toolbar of your table, and in the press event of add button call below method
OTable.addItem()
And also in success function of read method, copy the odata into json model and bind this model to view
Hope it works!
Regards,
Gowrinath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
no possible with odata model. you have to use jsonmodel to do that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.