如何在使用OData $ expand参数时将oData服务绑定到SAPUI5表
<Table id="contactPickerTable"
items="{path: 'modelPersons>/ContactSet',
filters : [{path : 'Customer',operator : 'EQ',value1:'2035235403'}]
parameters : {expand:'Address'}}"
>
.....
<ObjectIdentifier
title="{modelPersons>Title}"
text="{modelPersons>PersonId}" />
我知道上面列表绑定数据到一个表的例子是有效的。但是如果我的服务中有$ expand,那么如何在ObjectIdentifier中显示返回集合的属性?我的意思是什么是上下文路径?
服务器响应如下所示:
<entry>
<id></id>
<title type="text">PartnerSet('2010002791')</title>
<updated>2014-05-24T08:05:58Z</updated>
...
<link href="PartnerSet('2010002791')" rel="self" title="Partner"/>
<link href="PartnerSet('2010002791')/Address" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Address" type="application/atom+xml;type=feed" title="Address">
<m:inline>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" >
<id>PartnerSet('2010002791')/Address</id>
<title type="text">AddressSet</title>
<updated>2014-05-24T08:05:58Z</updated>
<author>
<name/>
</author>
<link href="PartnerSet('2010002791')/Address" rel="self" title="AddressSet"/>
<entry>
<id></id>
<title type="text">AddressSet('')</title>
<updated>2014-05-24T08:05:58Z</updated>
...
<d:FirstName>DM LABO SARL</d:FirstName>
<d:Name>DIDIER MARTIN LABORATOIRE</d:Name>
<d:Name3/>
...
...
如何访问“名称”属性?
尝试类似下面的内容,我假设地址有街道,州和国家,我把它们放在$ Select条件下限制返回的字段
<Table id="contactPickerTable"
items="{
path: 'modelPersons>/ContactSet',
filters : [{ path: 'Customer', operator: 'EQ', value1: '2035235403' }]
parameters: {
expand: 'Address',
select: 'Title,PersonId,Address/Street,Address/State,Address/Country'
}
}">
...
<ObjectIdentifier
title="{modelPersons>Title}"
text="{modelPersons>PersonId}" />
<Text
text="{modelPersons>Address/Street}"/>
<Text
text="{modelPersons>Address/State}"/>
<Text
text="{modelPersons>Address/Country}"/>