Odata 控制器中具有扩展实体属性的筛选器

Odata 控制器中具有扩展实体属性的筛选器,odata,sapui5,Odata,Sapui5,在主详细视图中,我有一个工作中心列表作为主部分,一个计划日历作为详细部分 <mvc:View controllerName="sap.ui.demo.wt.controller.Overview" xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" xmlns:semantic="sap.m.semantic" xmlns:unified="sap.ui.unified" xmlns:core="sap.ui.core" displayB

在主详细视图中,我有一个工作中心列表作为主部分,一个计划日历作为详细部分

<mvc:View controllerName="sap.ui.demo.wt.controller.Overview"
  xmlns="sap.m"
  xmlns:mvc="sap.ui.core.mvc"
  xmlns:semantic="sap.m.semantic"
  xmlns:unified="sap.ui.unified"
  xmlns:core="sap.ui.core" displayBlock="true"
>
  <Page title="{i18n>overviewPageTitle}">
    <SplitContainer>
      <masterPages>
        <semantic:MasterPage title="{i18n>overviewMasterTitle}">
          <List items="{data>/WorkCenterSet}">
            <ObjectListItem
              title="{data>WorkCntr}"
              type="Active"
              press="onWorkCtrPressed"
            />
          </List>
        </semantic:MasterPage>
      </masterPages>
      <detailPages>
        <semantic:DetailPage title="{i18n>overviewDetailTitle}">
          <VBox>
            <PlanningCalendar id="PC"
              startDate="{/StartDate}"
              rows="{
                path : 'data>/EmployeeSet',
                parameters : {
                  expand : 'OrderOperation, EmployeeWorkCenter'
                }
              }"
            >
              <rows>
                <PlanningCalendarRow
                  title="{data>UserFullname}"
                  appointments="{
                    templateShareable : true,
                    path : 'data>OrderOperation'
                  }"
                >
                  <appointments>
                    <unified:CalendarAppointment
                      startDate="{data>EarlSchedStartdate}"
                      endDate="{data>EarlSchedFindate}"
                      title="{data>Description}"
                    />
                  </appointments>
                </PlanningCalendarRow>
              </rows>
            </PlanningCalendar>
          </VBox>
        </semantic:DetailPage>
      </detailPages>
    </SplitContainer>
  </Page>
</mvc:View>
我首先尝试的方法不起作用,因为在实体集
“EmployeeSet”
中查询属性
“WorkCntr”
。但此属性仅存在于我在视图中展开的实体集“EmployeeWorkCenterSet”中。问题是:我甚至不知道我需要使用的查询。。。你能帮忙吗

PS:我的OData服务是版本2。疑问如

EmployeeSet?$expand=EmployeeWorkCenter($filter={any filter})
不起作用。

如上所述,您可以将导航属性名称前置到筛选器路径,如下所示:

new Filter({
  path: "EmployeeWorkCenter/WorkCntr", // "EmployeeWorkCenter" === navigation property from Employee
  operator: FilterOperator.StartsWith,
  value1: sWorkCntr
});
(我假设解析导航属性
EmployeeWorkCenter
返回一个对象,而不是另一个集合。否则,这在V2中不起作用)

的可能重复项
new Filter({
  path: "EmployeeWorkCenter/WorkCntr", // "EmployeeWorkCenter" === navigation property from Employee
  operator: FilterOperator.StartsWith,
  value1: sWorkCntr
});