cancel
Showing results for 
Search instead for 
Did you mean: 

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

0 Kudos

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 Customer '1000000' in popOver

expected-output.jpg

F12 Debugger Output:

f12.jpg

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.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">
    <m:Label text="Customer" id="CustomerNum"/>
    <template >
        <m:Link id="customerDetails" text="{mAggingData>Customer}" 
         wrapping="false" 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}" placement="Right" initialFocus="action">
    <footer>
        <Toolbar>
            <ToolbarSpacer/>
            <Button id="action" text="View Customer Details" press="navToCustomer"/>
        </Toolbar>
    </footer>
</Popover>
</core:FragmentDefinition>

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member194549
Contributor
0 Kudos

Hi emicox02

in your table the binding seems to have a model name (mAggingData)
In your popover, the binding of the title is specified only with {Customer}, so without the name of the model.

<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core">
<Popover id="myPopover" title="{mAggingData>Customer}" placement="Right" initialFocus="action">
    <footer>
        <Toolbar>
            <ToolbarSpacer/>
            <Button id="action" text="View Customer Details" press="navToCustomer"/>
        </Toolbar>
    </footer>
</Popover>
</core:FragmentDefinition>
this._oEditAddPopover.bindElement(oCtx.getPath()); 

Regards
Simon

junwu
Active Contributor
0 Kudos
    this._oEditAddPopover.bindElement(oCtx.getPath());give it a try
0 Kudos

Hi Jun,

Do you have any other suggestions here? When I try to use oCtx.getPath(), it gives me an index undefined error.

junwu
Active Contributor
0 Kudos

you are using jsonmodel?

junwu
Active Contributor
0 Kudos

try to avoid jsonmodel if possible. especially dealing the data from backend odata