SAPUI5 XmlView显示来自聚合绑定子项的数据

时间:2019-01-26 06:46:02

标签: odata sapui5

我需要在表列表中获取每个ContactEmployees客户的所有BusinessPartners联系人。联系人已加载,但我无法显示字段

我的请求https://***/BusinessPartners?$select=ContactEmployees&$skip=0&$top=20

请求“仅选定的ContactEmployees”的我的JSON结果

{
   "@odata.context" : "https://**********$metadata#BusinessPartners",
   "value" : [
      {
         "ContactEmployees" : [
            {
               "CardCode" : "C000002",
               "Name" : "Jose Duran",
               "Position" : null,
               "Address" : null,
               "Phone1" : null,
               "Phone2" : null
            },
            {
               "CardCode" : "C000003",
               "Name" : "Leo Manuel",
               "Position" : null,
               "Address" : null,
               "Phone1" : null,
               "Phone2" : null
            }
         ]
      },
      {
         "ContactEmployees" : [
            {
               "CardCode" : "C000010",
               "Name" : "MILDRED MEJIA",
               "Position" : null,
               "Address" : null,
               "Phone1" : null,
               "Phone2" : null
            }
         ]
      },
      {
         "ContactEmployees" : []
      },
      {
         "ContactEmployees" : []
      }
   ],
   "@odata.nextLink" : "BusinessPartners?$select=ContactEmployees&$skip=23&$top=5"
}

我的表格视图

            <Table id="idPartnerTable"
                    growing="true"
                    growingScrollToLoad="true"
                    inset="false"
                    items="{
                        path: '/BusinessPartners',
                        parameters:{
                        $select:'ContactEmployees,CardCode'
                        },
                        sorter: {
                            path: 'CardCode'
                        }
                    }">
                    <columns>
                        <Column id="carcode">
                            <Text text="ID" />
                        </Column>
                        <Column id="nombre" >
                            <Text text="Name" />
                        </Column>

                    </columns>
                    <items>
                        <ColumnListItem
                            type="Navigation"
                            press="onPress">                            
                            <cells>
                                <Text text="{ContactEmployees/CardCode} "/>
                                <Text text="{ContactEmployees/Name} "/>
                            </cells>
                        </ColumnListItem>
                    </items>
            </Table>

控制台错误

  

无法深入查看('BUSINESSPARTNERS   CODES')/ ContactEmployees / Name,无效的区隔:Name-   / ****** / BusinessPartners?$ select = ContactEmployees,CardCode&$ orderby = CardCode sap.ui.model.odata.v4.lib._Cache

如果我将{ContactEmployees/Name}更改为{ContactEmployees/0/Name},则只显示一个联系人,而我需要全部带走

1 个答案:

答案 0 :(得分:0)

使用扩展选项以获取每个BusinessPartners的ContactEmployees。 试试这个:

ionic cordova run ios  --target="iPhone-6s" -l

这是一个可以帮助您的朋克:Output