on 10-15-2017 12:25 PM
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
Hi Muhsin,
Could you please check if odata service returns data?
Did you check console log returning any error?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
7 | |
7 | |
6 | |
6 | |
6 | |
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.