Skip to Content
avatar image
Former Member

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Jul 26, 2017 at 10:08 AM

    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)

    });

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 26, 2017 at 05:50 AM

    your code please

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 25, 2017 at 02:21 PM

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

    Regards,

    Jamie

    Add comment
    10|10000 characters needed characters exceeded