Skip to Content
0

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

Jul 25, 2017 at 09:58 AM

65

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Jithin Kumar Jul 26, 2017 at 10:08 AM
0

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)

});

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks Jitin,

Issue resolved following suggested code.

0
Jun Wu Jul 26, 2017 at 05:50 AM
0

your code please

Share
10 |10000 characters needed characters left characters exceeded
Jamie Cawley
Jul 25, 2017 at 02:21 PM
0

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

Regards,

Jamie

Share
10 |10000 characters needed characters left characters exceeded