Skip to Content
0
Jul 19, 2016 at 07:49 AM

getBindindingContext is undefined

1830 Views

Hi Experts,

I am stuck while implementing 'When user select any item' display the list in other panel. I am following the SAP UI5 tutorials week 2 Unit 5, i am doing it in eclipse with my ABAP server.

Here issue is my getBindingContext is undefined every time.

My controller code is:

This gets called when i select any row:

onSelectionChange : function(oEvent) {

//var oSelectedItem = oEvent.getSource(); ==>I have used this code also ,every time oContext is undefined var oSelectedItem = oEvent.getParameter("listItem"); var oContext = oSelectedItem.getBindingContext();

// var oContext = // oEvent.getParameters("objectlistitem").getBindingContext(); var sPath = oContext.getPath(); var oProductDetailPanel = this.byId("productDetails");

oProductDetailPanel.bindElement({ path : sPath }); this.byId("productDetails").setVisible(true);

},

Code from XML View:

<List xmlns="sap.m" id="listid" busy="false" busyIndicatorDelay="1000" visible="true" fieldGroupIds="" inset="false" headerText="Product List" headerDesign="Standard" footerText="Footer" items="{odata>/EpmProductSet}" selectionChange="onSelectionChange" mode="SingleSelect" includeItemInSelection="true" growing="true" growingThreshold="5" growingTriggerText="More Items" growingScrollToLoad="false"> <headerToolbar> <Toolbar> <Title text="{i18n>productListTitle}" /> <ToolbarSpacer /> <SearchField search="onSearch" width="50%" /> </Toolbar> </headerToolbar> <items> <!-- sap.m.ListItemBase --> <ObjectListItem xmlns="sap.m" id="objectlistitem" title="{odata>Name}"

number="{ parts: [ {path: 'odata>Price'}, {path: 'odata>CurrencyCode'}], type: 'sap.ui.model.type.Currency', formatOptions: { currencyCode: true} }"

intro="{odata>ProductId}" icon=" " activeIcon="" iconDensityAware="true" markFavorite="" markFlagged="" showMarkers="" numberState="{= ${odata>Price} > 200 ? 'Error' : 'Success'}" titleTextDirection="Inherit" introTextDirection="Inherit" numberTextDirection="Inherit" markLocked="false" ariaLabelledBy="" validateFieldGroup="" tap="" detailTap="" press="" detailPress=" "> <firstStatus> <ObjectStatus text="{parts: [{path: 'odata>WeightUnit'},{path: 'odata>WeightMeasure'} ], formatter : '.formatter.delivery' }" /> </firstStatus>

</ObjectListItem> </items> </List>

My filter part is working fine. issue with this only line selection.

Regards,

Ashish