Skip to Content
avatar image
Former Member

oData collection not binding to table rows

Hi experts,

I am developing a UI5 web application which consumes oData collections.
One of these oData collection is fetched using get_expanded_entityset method which I implemented in my oData service

The get_expanded_entityset method returns both header and line items in the form of a collection of items [in my case it is called 'toPosition' navigation property]

Now I have a data table which is binded to that oData method but I am not able to get the single line items data displayed into each cell.

This is the data bind code I use

         var oModelCarrier = new sap.ui.model.odata.ODataModel('/sap/opu/odata/sap/Z_COLL_PORTAL_SRV',{json:true});

         var tableCarrier = sap.ui.getCore().byId("carrierInvoiceSub-carrierSubmission--carrierTable");

         tableCarrier.setModel(oModelCarrier);

         oModelCarrier.setCountSupported(false);

         tableCarrier.bindRows( {path: '/fileRepositorySet',

                  filters : [ new sap.ui.model.Filter("fileId", sap.ui.model.FilterOperator.EQ, fileid) ],

                  parameters : {expand: 'toPosition'}

         });

and this is the table view part

        <table:Table id="carrierTable" enableGrouping="true" enableSorting="true">

              <table:title><Textview text="Carrier Shipments [Uploaded]"></Textview></table:title>

              <table:columns>

                 <table:Column>

                     <Label text="Invoice Num."/>

                     <table:template>

                           <layout:VerticalLayout content="{toPosition/results}" xmlns:layout="sap.ui.layout">

                              <layout:content>              

                                   <TextView text = "{invoiceNumber}" />               

                               </layout:content>

                           </layout:VerticalLayout>

                     </table:template>

                 </table:Column>

                 <table:Column>

                     <Label text="Container Type"/>

                     <table:template>

                           <layout:VerticalLayout content="{toPosition/results}" xmlns:layout="sap.ui.layout">

                              <layout:content>              

                                   <TextView text = "{containerType}" />               

                               </layout:content>

                           </layout:VerticalLayout>

                     </table:template>

                 </table:Column>

              </table:columns>

         </table:Table>

and most important this is the oData response I get from my service calling get_expanded_entityset

can anyone help me how to get collection data displayed on table cells ?
it seems the response I get is correct containing all the data I need for my application.

please be patient with me, I am learning oData / UI5 technology so I am not an expert

best regards,

claudia

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 19, 2015 at 06:22 AM

    Hello Claudia,

    First thing is you need to check if the problem is at the OData service level or the UI5 app level.

    Go to spro->SAP netweaver->gateway->OData channel->Administration->support utilites->Traces

    Put up a payload trace, and run your application again.

    Go back to spro and check if you get the right trace.

    If yes-

    Check if the service gives you correct data by going to /IWFND/GW_CLIENT.

         if yes-

         You are going wrong at the UI5 app level, you might consider posting this in SAPUI5 Developer Center and not here. 😊

         if no-

         post it here.

    If no-

    post it here.

    Cheers,

    -NK

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 17, 2015 at 03:32 PM

    Also when I using the following tamplate into each column I get duplicated data

    <table:Table id="carrierTable" enableGrouping="true" enableSorting="true">

            <table:title><Textview text="Carrier Shipments [uploaded]"></Textview>   </table:title>

                  <table:columns>

                     <table:Column>

                         <Label text="Invoice Num."/>

                         <table:template>

                               <layout:VerticalLayout content="{toPosition}" xmlns:layout="sap.ui.layout">

                                  <layout:content>              

                                       <TextView text = "{invoiceNumber}" />               

                                   </layout:content>

                               </layout:VerticalLayout>

                         </table:template>

                     </table:Column>

                     <table:Column>

                         <Label text="Container Type"/>

                         <table:template>

                               <layout:VerticalLayout content="{toPosition}" xmlns:layout="sap.ui.layout">

                                  <layout:content>              

                                       <TextView text = "{containerType}" />               

                                   </layout:content>

                               </layout:VerticalLayout>

                         </table:template>

                     </table:Column>

         </table:columns>

    </table:Table>

    And the result is shown in this attachment..

    Any hint on this ?

    Add comment
    10|10000 characters needed characters exceeded