cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to get values in local josn model after oData Read call

Former Member
0 Kudos

Hello Experts,

I am reading one Odata entity set with some Filter Parameter and trying to set the response values in to local json model. I am unable to get any values in local json model although entity set call is working fine ( seen in debugger "Network " tab).

Response is coming in below structure:

{d: {,...}}

d:{,...}

results:[{__metadata:{,...},

0:{__metadata:{,..}

1:{--metadata"{,..}

I need to bind the values to table in XML View and populate multiple Line Items.

Can anyone help me with code/resolution for the same.

Thanks,

Anjana

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Need to see your code to undestand the real issue, but you can use the given code to read the oData and to set model to the view.

Then in you XML view you need to bind properties.

your_oModel.read("/entityname",["YourParameters"], {

fnSuccess: jQuery.proxy(function(oData) {

//onRead success

var oModel = new sap.ui.model.json.JSONModel();

oModel.setData(oData);

this.getView().setModel(oModel);

/* You can perform rest of the activities here

*

* /

}, this),

fnError: $.proxy(function(xhr) {

//perfom your action on error

}, this)

});

Former Member
0 Kudos

Thanks Jitin,

Issue resolved following suggested code.

Answers (2)

Answers (2)

junwu
Active Contributor
0 Kudos

your code please

jamie_cawley
Advisor
Advisor
0 Kudos

Any reason why you are not using the odata model? Seems it would make this easier.

Regards,

Jamie