Skip to Content

Get oData from model binded to view

Hi experts,

I have binded my data to my view like this:

var key = "/SalesSet('" + oEvent.getParameter("arguments").salesactivity + "')";

var pgDetail = sap.ui.getCore().byId("pgDetail");

pgDetail.bindElement(key);

pgDetail is the ID of the Page element on this view.

When executing this line: console.log(sap.ui.getCore().byId("pgDetail").getModel()); I see the model that was binded to the view.

Now I would like to have access to these objects that are located in the oData object. How can I do this?

Kind regards,

Bart Geudens

Capture.PNG (133.2 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Dec 12, 2014 at 12:15 PM

    in order to access the model items, you need to go into the hierarchy of your objects, from your example, you could read them like this: sap.ui.getCore().byId("pgDetail").getModel().oData.data

    add the oData.data piece to your example and you should have access to your data

    hope this helps

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 12, 2014 at 12:16 PM

    data = sap.ui.getCore().byId("pgDetail").getModel().getData();

    Now you can loop over data and access it like an object.


    or sap.ui.getCore().byId("pgDetail").getModel().getProperty("-path-");


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 12, 2014 at 12:32 PM

    Hi Bart,

    By using controls in sapui5(table) you have to display the data which is available in oData object.

    or otherwise, you have to use get the data through response object which is available in oData object shown at console.


    I hope it may be helpful for u




    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.