Skip to Content

Uncaught TypeError: Cannot read property 'getProperty' of undefined - Json Model - XML View

May 15, 2017 at 03:51 AM


avatar image
_showObject: function(oItem) {<br>    this.getRouter().navTo("invlineitem", {<br>       invRefID: oItem.getBindingContext().getProperty("invoiceReferenceID")<br>    });<br>

This is all there to it, My manifest.json has reference to invRefID, I am always getting a type error. Can you please point me to any working example with Json data to resolve the above issue.

The scenario is: Select the line item, click on the button to navigate to line item details page.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Mahesh kumar palavalli May 15, 2017 at 05:48 AM

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,

10 |10000 characters needed characters left characters exceeded
Gunasekhar Reddy Nalla Gar Jun 09, 2017 at 08:57 PM

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.

10 |10000 characters needed characters left characters exceeded
Janani S Oct 16, 2017 at 11:57 AM

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">
			<Table class="sapUiResponsiveMargin" width="auto" items="{detail>/Suppliers}">
					<Title text="Number of Suppliers: {detail>/CountSuppliers}"/>
							<Text text="ID"/></header>
							<Text text="Name"/></header>
					<ColumnListItem type="Navigation" press="onListPress">
							<ObjectIdentifier text="{detail>ID}"/>
							<ObjectIdentifier text="{detail>Name}"/>

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") });
10 |10000 characters needed characters left characters exceeded