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

SAPUI5 how to bind index/position property within odata aggregation

Hi experts/colleagues,

I am developing a table into my SAPUI5 application and for one of the columns I need to specifiy an ID attribute
based on index/position from odata aggregation got from my backend service.

Is it possible something like I did in the first column for the id attribute the following code ?

id="trackingNumber{index}" where trackingNumber is a static string and {index} would be ideally the position within the oData response.

<table:columns>

<table:Column width="100px">

<Label text="Tracking Num."/>

<table:template id="trackingNumber{index}"><Textview text="{ItemBoxTrackingNo}"/></table:template>

</table:Column>

<table:Column width="95px">

<Label text="Id"/>

<table:template><Textview text="{OrderID}"/></table:template>

</table:Column>

</table:columns>

Or if you know a solution to implement this, some method to read the position / the index of the object been read from oData response into table,

I will appreciate any hint or feedback.

Regards,

Claudia

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Sep 25, 2015 at 03:39 PM

    id is a static field and also its don't having the binding aggregation. so its not possible.

    And through model binding you can achieve the table functionalities. id is not necessary.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Sai Vellanki

      Hi Sai,

      After implemented you correct solution, I had to replace an oData binding with the table on the left.

      Basically in your code I adapted the following line but I cannot make it work to filter the unmatched lines.

      var oHeaderModel = sap.ui.getCore().getModel().getProperty("/modelData/headerData/oModel/oData");

      The model data for the table on the left is stored inside /modelData/headerData/oModel/oData and it contains a collection of objects.

      Do you think there is something wrong in the code I have adapted/modified ?

      Regards,

      Claudia

  • Posted on Oct 09, 2015 at 02:27 AM

    Claudia,

    Can you share the code and JSON model ? It will be easy for me to check where it might be going wrong.

    Thank you!

    Regards,

    Sai Vellanki.

    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.