简体   繁体   中英

SAP UI5: OData Binding for Header and Detail Set in a PopOver

I am trying to bind a popover to display the line item data based on what was clicked. I am working on a header and detail ODATA set. I am able to display the popover, just having an issue displaying the clicked value. Details below. Thank you in advance.

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

Popover Controller code:

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);
},

Data Path:

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

View.xml Code:

<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>

View Customer Options Pop Over - {Customer} not outputting the data in the popover:

<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

Update:

Binding from HeaderSet, but it still does not give the expected output from mAggingData > VendorDetails > categories:

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>

Prefix the binding in the popover with the model name (ie title="{mAggingData>Customer}" ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM