Skip to Content
author's profile photo Former Member
Former Member

Access value of my oData model

Hi there,

I've created a form which fields are bound to a oData model.

That works fine.

But now I've the following problem:

I have a value RequestTypeID in my model which should not be displayed on the view, but which should be used to determine how data should be displayed on the view.

How can I access that value?

I've tried the following:

var oTextRequestTypeID = new sap.ui.commons.TextField(
     "textRequestTypeID",
     {
          value : "{HandleRequestType/Request/RequestTypeID}"
     });

var requestTypeID = "";
requestTypeID = oTextRequestTypeID.getValue();

Nevertheless my variable requestTypeID still keeps the value "".

But if I display the TextField oTextRequestTypeID on the screen, it displays the correct value.

My question:

What is the best practice to access such values which should not be displayed on the view?

Is it possible to bind it directly to a variable?

Thanks in advance.

Best regards,

Thorsten.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Aug 06, 2014 at 10:09 AM

    Hi,

    you can use getProperty() method. Refer SAPUI5 SDK - Demo Kit

    Also refer this document Playing with the model on SAP UI5 for more information.

    Regards,

    Chandra

    Add a comment
    10|10000 characters needed characters exceeded

    • Nothing like replying to a thread over a 18 months old but I generally attach these methods in my onInit() thus:

      this.oModel.attachRequestFailed(jQuery.proxy(this.doRequestFailed, this));
      

      Where doRequestFailed is defined in the class later on.

      Just a note for someone else stumbling across this thread in the next 18 months or so 😊

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2016 at 07:19 AM

    This message was moderated.

    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.