SAPUI5 XmlView Показать данные из дочерней привязки агрегации - PullRequest
0 голосов
/ 26 января 2019

Мне нужно получить все ContactEmployees контакты каждого клиента BusinessPartners в списке таблиц. Контакты загружены, но я не могу показать поля

Мой запрос https://***/BusinessPartners?$select=ContactEmployees&$skip=0&$top=20

Мой результат 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>

ОШИБКИ КОНСОЛИ

Не удалось выполнить детализацию ('БИЗНЕСПАРТНЕРЫ CODES ') / ContactEmployees / Имя, недопустимый сегмент: Имя - / ****** / BusinessPartners? $ Select = ContactEmployees, CardCode & $ orderby = CardCode sap.ui.model.odata.v4.lib._Cache

Если я изменю {ContactEmployees/Name} на {ContactEmployees/0/Name}, они отображаются, но только 1 единственный контакт, и мне нужно привести их всех

1 Ответ

0 голосов
/ 26 января 2019

Используйте опцию расширения, чтобы получить ContactEmployees каждого BusinessPartners.попробуйте это:

 <Table id="idPartnerTable"
                    growing="true"
                    growingScrollToLoad="true"
                    inset="false"
                    items="{
                        path: '/BusinessPartners',
                        parameters:{
                        expand:'ContactEmployees'
                        },
                        sorter: {
                            path: 'CardCode'
                        }
                    }">

вот плункер, он может вам помочь: http://plnkr.co/edit/Q6KqSRk4kk0V81AdCrvQ?p=preview

...