can you check in the debugging if the importing parameter oItem has any data or it is undefined?
if it is coming as undefined, you might not be fetching the item properly, paste the table code and the code where you are calling the _showObject method if possible.
Best Regards,
Mahesh
Hi Mahesh,
Sorry for the late reply. I was in really in a hurry. Actually I made it work using the below statement.
var temp = oEvent.getSource().getSelectedContexts()[0].getObject(); and then passing temp to invRefId. Thanks for your answer.
I am getting value for oItem. But getting the same error as uncaught type error getProperty() of undefined.
view code:
<mvc:View controllerName="sapui5.demo.mvcapp.controller.Master" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"> <Page title="Supplier Overview"> <content> <Table class="sapUiResponsiveMargin" width="auto" items="{detail>/Suppliers}"> <headerToolbar> <Toolbar> <Title text="Number of Suppliers: {detail>/CountSuppliers}"/> </Toolbar> </headerToolbar> <columns> <Column> <header> <Text text="ID"/></header> </Column> <Column> <header> <Text text="Name"/></header> </Column> </columns> <items> <ColumnListItem type="Navigation" press="onListPress"> <cells> <ObjectIdentifier text="{detail>ID}"/> <ObjectIdentifier text="{detail>Name}"/> </cells> </ColumnListItem> </items> </Table> </content> </Page> </mvc:View>
controller code:
onListPress : function(oEvent) {
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
var oItem = oEvent.getSource();
oRouter.navTo("detail", { ID: oItem.getBindingContext().getProperty("ID") });
}
Add comment