cancel
Showing results for 
Search instead for 
Did you mean: 

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

0 Kudos
_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.

View Entire Topic
janani_10
Explorer
0 Kudos

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") });
}
glauco
Active Contributor
0 Kudos

Hi.
I think you can solve as following.
As you configured items={detail>/CountSuppliers}

then, you shoud probably config items like as e.g. detail>/CountSuppliers>field1

/CountSuppliers here is a top level entity.

Or you can try items={detail>/} as / is a top level with no need for a top level entity.

So in items you can fillup as you're already filling.
<ObjectIdentifier text="{detail>ID}"/>