我有一个sap.m.List组件,用于调用OData对象列表。该对象内部有其他对象。出于这个原因,我使用expand参数来访问实习对象的属性。但是当我在“expand”参数上放置多个对象时,列表组件不起作用:
这种方式不起作用:
<List id="lstRequest" headerText="Custom Content"
items="{
path: '/Requests',
parameters: {
expand: ['RequestTypeDetails', 'UsersDetails']
}
}"
>
<StandardListItem
title="{RequestTypeDetails/RequestType2} - {RequestCode}"
description="{TotalAdvance}"
icon="sap-icon://request"
iconDensityAware="false"
iconInset="false"
type="Navigation"
press="onSelectApprovation" />
</List>
这种方式有效:
<List id="lstRequest" headerText="Custom Content"
items="{
path: '/Requests',
parameters: {
expand: 'RequestTypeDetails'
}
}"
>
<StandardListItem
title="{RequestTypeDetails/RequestType2} - {RequestCode}"
description="{TotalAdvance}"
icon="sap-icon://request"
iconDensityAware="false"
iconInset="false"
type="Navigation"
press="onSelectApprovation" />
</List>
当我需要在“expand”参数上使用multiples objets时,我不知道具体情况。
感谢您的帮助!
更新1
@Nabi的解决方案看起来有效...但我不安全,因为我在详细页面上调用了列表元素。
我使用list元素创建一个JSONModel对象,然后在详细信息页面上调用此对象:
var itemJSONModel = new JSONModel(itemObject, false);
this.setModel(itemJSONModel, "detailView");
但在我的详细信息页面中,我看不到UsersDetails属性的值(Users是项目对象内的一个对象.UsersDeails是NavigationProperty的名称):
<Input fieldGroupIds="datos_suscripcion" value="{detailView>/UsersDetails/UserName}"
placeholder="Usuario..."
id="inUsuario"/>
编辑2
这是项目对象的OData模型:
<EntityType Name="Request">
<Key>
<PropertyRef Name="Id"/>
</Key>
<Property Name="AirTicketBuyer" Type="Edm.String" Nullable="true" MaxLength="50"/>
<Property Name="AirTicketBuyerEmail" Type="Edm.String" Nullable="true" MaxLength="50"/>
<Property Name="BusTicketBuyer" Type="Edm.String" Nullable="true" MaxLength="50"/>
<Property Name="BusTicketBuyerEmail" Type="Edm.String" Nullable="true" MaxLength="50"/>
<Property Name="CostCenter" Type="Edm.Int32" Nullable="false"/>
<Property Name="Created" Type="Edm.DateTime" Nullable="false"/>
<Property Name="Currency" Type="Edm.Int32" Nullable="false"/>
<Property Name="Department" Type="Edm.Int32" Nullable="false"/>
<Property Name="DepartureDate" Type="Edm.DateTime" Nullable="false"/>
<Property Name="DepartureRoute" Type="Edm.String" Nullable="false" MaxLength="100"/>
<Property Name="DepartureTransportationType" Type="Edm.String" Nullable="false" MaxLength="1"/>
<Property Name="Destination" Type="Edm.String" Nullable="false" MaxLength="128"/>
<Property Name="DestinationType" Type="Edm.String" Nullable="false" MaxLength="1"/>
<Property Name="ExpirationDate" Type="Edm.DateTime" Nullable="false"/>
<Property Name="Id" Type="Edm.Int32" Nullable="false"/>
<Property Name="IdApplicant" Type="Edm.Int32" Nullable="true"/>
<Property Name="IdCompany" Type="Edm.Int32" Nullable="false"/>
<Property Name="IdUser" Type="Edm.Int32" Nullable="false"/>
<Property Name="Reason" Type="Edm.String" Nullable="false" MaxLength="200"/>
<Property Name="RequestCode" Type="Edm.String" Nullable="false" MaxLength="15"/>
<Property Name="RequestFatherId" Type="Edm.Int32" Nullable="true"/>
<Property Name="RequestStatus" Type="Edm.Int32" Nullable="false"/>
<Property Name="RequestType" Type="Edm.Int32" Nullable="false"/>
<Property Name="ReturnDate" Type="Edm.DateTime" Nullable="false"/>
<Property Name="ReturnRoute" Type="Edm.String" Nullable="false" MaxLength="100"/>
<Property Name="ReturnTransportationType" Type="Edm.String" Nullable="false" MaxLength="1"/>
<Property Name="SapCodeApplicant" Type="Edm.String" Nullable="true" MaxLength="6"/>
<Property Name="SapCodeUser" Type="Edm.String" Nullable="true" MaxLength="6"/>
<Property Name="StartFlowDate" Type="Edm.DateTime" Nullable="false"/>
<Property Name="TipoReq" Type="Edm.String" Nullable="true" MaxLength="2"/>
<Property Name="TotalAdvance" Type="Edm.Decimal" Nullable="false" Precision="12" Scale="2"/>
<NavigationProperty Name="ApprovalsRequestDetails" Relationship="rva-persistence.ApprovalsRequest_Request_Many_ZeroToOne0" FromRole="Request" ToRole="ApprovalsRequest"/>
<NavigationProperty Name="CostCenterDetails" Relationship="rva-persistence.Request_CostCenter_Many_ZeroToOne0" FromRole="Request" ToRole="CostCenter"/>
<NavigationProperty Name="CurrencyDetails" Relationship="rva-persistence.Currency_Request_One_Many0" FromRole="Request" ToRole="Currency"/>
<NavigationProperty Name="DepartmentDetails" Relationship="rva-persistence.Department_Request_One_Many0" FromRole="Request" ToRole="Department"/>
<NavigationProperty Name="ExpenseAdvanceDetails" Relationship="rva-persistence.ExpenseAdvance_Request_Many_ZeroToOne0" FromRole="Request" ToRole="ExpenseAdvance"/>
<NavigationProperty Name="CompanyDetails" Relationship="rva-persistence.Company_Request_One_Many0" FromRole="Request" ToRole="Company"/>
<NavigationProperty Name="UsersDetails" Relationship="rva-persistence.Users_Request_One_Many0" FromRole="Request" ToRole="Users"/>
<NavigationProperty Name="PassengerDetails" Relationship="rva-persistence.Passenger_Request_Many_ZeroToOne0" FromRole="Request" ToRole="Passenger"/>
<NavigationProperty Name="ReportDocumentDetails" Relationship="rva-persistence.ReportDocument_Request_Many_ZeroToOne0" FromRole="Request" ToRole="ReportDocument"/>
<NavigationProperty Name="RequestStatusDetails" Relationship="rva-persistence.Request_RequestStatus_Many_ZeroToOne0" FromRole="Request" ToRole="RequestStatus"/>
<NavigationProperty Name="RequestTypeDetails" Relationship="rva-persistence.RequestType_Request_One_Many0" FromRole="Request" ToRole="RequestType"/>
</EntityType>
答案 0 :(得分:0)
使用简单的逗号分隔字符串:
<List
id="lstRequest"
headerText="Custom Content"
items="{
path: '/Requests',
parameters: {
expand: 'RequestTypeDetails,UsersDetails'
}
}"
>