Pracuję nad splitapp
.SAP UI5 - getBindingContext() undefined (splitapp)
Po wybraniu pozycji z listy, to mówi
Uncaught TypeError: Cannot read property 'getPath' of undefined
Master.controller.js
onSelect : function(oEvent) {
this.showDetail(oEvent.getParameter("listItem") || oEvent.getSource());
},
showDetail : function(oItem) {
var bReplace = jQuery.device.is.phone ? false : true;
this.getRouter().navTo("detail", {
from: "master",
entity: oItem.getBindingContext().getPath().substr(1),
tab: this.sTab
}, bReplace);
}
Jestem wiązania JSON Model
do listy.
oItem.getBindingContext()
jest niezdefiniowany. Uważam, że problem dotyczy kontekstu wiążącego.
Kod na liście w Master.view.xml jest poniżej
<content>
<List
id="list"
select="onSelect"
mode="SingleSelect"
noDataText="{i18n>masterListNoDataText}"
growing="true"
growingScrollToLoad="true"
items="{data>/results}">
<items
id="masterList">
<ObjectListItem
id="listItem"
press="onSelect"
type="{device>/listItemType}"
counter="0"
title="{data>PROJECTNAME}"
number="{data>REVENUE}"
numberUnit="{data>CURRENCY}"
markFavorite="false"
markFlagged="false"
showMarkers="true">
</ObjectListItem>
</items>
</List>
</content>
mam ustawić model w Component.js jak poniżej:
var oModel= new sap.ui.model.json.JSONModel();
oModel.loadData("Data.json");
this.setModel(oModel,"data");
Lista jest wyświetlane, ale gdy wybiorę przedmiot, błąd pojawia się.
To działało bez zarzutu. :) – FEBzX
@FEBzX, Cieszę się, że ci pomogę :) – Rayon