cancel
Showing results for 
Search instead for 
Did you mean: 

first Item is not binding into detailpage in splitApp in SAPUI5

muhsin_panakkal
Participant
0 Kudos

Hai Experts,

I am developing one splitApp application in webIDE from the standard template, in this application am passing one parameter from the other application to this application to filter the odata from the master list. I am getting the parameter in Component.js and the code is added below.

var oComponentData = this.getComponentData();
var Ltype = oComponentData.startupParameters.LeaveID[0];
window.localStorage.setItem("WindowLtype", Ltype);

after this am passing the above parameter value to filter in listItem under ListSelector.js.

this._oWhenListHasBeenSet
.then(function(oList) {
/*Custom code Starts*/
var Ltype = window.localStorage.getItem("WindowLtype"); //added code
var oFilterLeave = new sap.ui.model.Filter("LeaveType", //added code
sap.ui.model.FilterOperator.EQ, Ltype
);
oList.getBinding("items").filter(oFilterLeave); //seting to filter
// oList.getBinding("items").attachFilter(oFilterLeave);
/* Ends */
oList.getBinding("items").attachEventOnce("dataReceived",
function(oData) {
if (!oData.getParameter("data")) {
fnReject({
list: oList,
error: true
});
}
var oFirstListItem = oList.getItems()[0];
if (oFirstListItem) {
// Have to make sure that first list Item is selected
// and a select event is triggered. Like that, the corresponding
// detail page is loaded automatically
fnResolve({
list: oList,
firstListitem: oFirstListItem
});
} else {
// No items in the list
fnReject({
list: oList,
error: false
});
}
}
);
});

After adding the above filter,

var oFirstListItem = oList.getItems()[0];

am getting the above line as undefined. because of this in my application the initial binding is getting error. once the item is selected from the master page the binding is proper.

Please help me to resolve the above issue.

Thanks,

Muhsin

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member516423
Participant
0 Kudos

Hi Muhsin,

Could you please check if odata service returns data?

Did you check console log returning any error?