【问题标题】:SAP UI5: OData Binding for Header and Detail Set in a PopOverSAP UI5:PopOver 中标题和详细信息集的 OData 绑定
【发布时间】:2021-03-15 16:55:06
【问题描述】:

我正在尝试绑定一个弹出框以根据点击的内容显示订单项数据。我正在处理标题和详细信息 ODATA 集。我能够显示弹出框,只是在显示单击的值时出现问题。详情如下。提前谢谢你。

What I want to achieve: Display 100000 in the popover when clicked.

弹窗控制器代码:

viewDetails: function(oEvent) {
            
    var oEve = oEvent.getSource();
    
    var oCtx = oEvent.getSource().getParent().getBindingContext("mAggingData"); 

    if (!this._oEditAddPopover) {
        this._oEditAddPopover = sap.ui.xmlfragment("Viewcustomeroptions", "Z_AR_AGING.view.ViewCustomerOptions",
        this);  
    }

    this.getView().addDependent(this._oEditAddPopover);
    this._oEditAddPopover.bindElement(oCtx.getPath().split('/')[2]);
    this._oEditAddPopover.openBy(oEve);
},

数据路径:

rows="{ path:'mAggingData>/VendorDetails', hierarchyLevelFor : 'Heirarchy', parameters: {arrayNames:['categories']} }"

View.xml 代码:

<Column width="8rem" id="id_level0" sortProperty="Customer" filterProperty="Customer" class="sortingProp">
    <m:Label text="Customer" id="CustomerNum"/>
    <template >
        <m:Link id="customerDetails" text="{mAggingData>Customer}" wrapping="false" class="applyRowHighlight" press="viewDetails"/>
    </template>
</Column>

查看客户选项弹出窗口 - {Customer} 未在弹出窗口中输出数据:

<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core">
<Popover id="myPopover" title="{Customer}" class="sapUiPopupWithPadding" placement="Right" initialFocus="action">
    <footer>
        <Toolbar>
            <ToolbarSpacer/>
            <Button id="action" text="View Customer Details" press="navToCustomer"/>
        </Toolbar>
    </footer>
</Popover>
</core:FragmentDefinition>

F12 Debugger Output of SPath

更新:

从 HeaderSet 绑定,但它仍然没有从 mAggingData > VendorDetails > 类别中给出预期的输出:

Output

<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core">
<Popover id="myPopover" title="{mAggingData>Customer}" class="sapUiPopupWithPadding" placement="Right" initialFocus="action">
    <content>
     <List id="listPopover" items = "{/CustHeadSet}">
        <StandardListItem title="{Customer}"/>
     </List>
    </content>
    <footer>
        <Toolbar>
            <ToolbarSpacer/>
            <Button id="action" text="View Customer Details" press="navToCustomer"/>
        </Toolbar>
    </footer>
</Popover>                                          
</core:FragmentDefinition>

【问题讨论】:

  • 您是否尝试过直接设置上下文而不是创建路径? this._oEditAddPopover.setBindingContext(oEvent.getSource().getBindingContext("mAggingData"));

标签: odata sapui5 popover


【解决方案1】:

在弹出框的绑定前加上模型名称(即title="{mAggingData&gt;Customer}")。

【讨论】:

  • 谢谢,但这不起作用...我能够使用 CustHeadSet 绑定它(实际的标头详细信息实体集,但我需要能够通过 mAggingData 检索其他值.. . 请查看修改
猜你喜欢
  • 1970-01-01
  • 2020-10-15
  • 1970-01-01
  • 2018-08-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多