on 10-15-2015 8:50 AM
Hi All,
I have a xml split view app that works correctly. However when I add Sorting to the Master List XML I start to see the error "Uncaught TypeError: Cannot read property 'getPath' of undefined"
The sorting was added like this, and it displays correctly when I run the app,
items="{
path : '/Carriers',
sorter : {
path : 'Category',
group : true
}
The error in the code appears here:
showDetail: function(oItem) {
// If we're on a phone device, include nav in history
var bReplace = jQuery.device.is.phone ? false : true;
this.getRouter().navTo("detail", {
from: "master",
entity: oItem.getBindingContext().getPath().substr(1),
tab: this.sTab
}, bReplace);
},
Thanks,
Stuart
So it looks like adding Sorting was triggering the 'Select' event somehow, and the Grouping was adding items to my list array.
I changed the onSelect function as follows and now it seems to work:
onSelect: function(oEvent) {
// Get the list item either from the listItem parameter or from the event's
// source itself (will depend on the device-dependent mode)
//this.showDetail(oEvent.getParameter("listItem") || oEvent.getSource());
//this.showDetail( oEvent.getSource());
if (!sap.ui.Device.system.phone) {
var oList = this.getView().byId("list");
var aItems = oList.getItems();
if (aItems.length && !oList.getSelectedItem()) {
oList.setSelectedItem(aItems[1], true);
this.showDetail(aItems[1]);
} else {
this.showDetail(oList.getSelectedItem());
}
}
},
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
try using
oItem.getSource().getBindingContext().getPath().
If you are using multimodel binding use
oItem.getSource().getBindingContext("<modelname>").getPath().
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stuart,
Can you run the program in debugging mode and place a break point on showDetail function. When it hits the break point, type this in console and check what you're getting for oItem.getBindingContext().getPath()
check oItem.getBindingContext() as well.
Regards,
Sai Vellanki.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.