I'm getting error with getBindin function.I have to filter data as soon as the page loads.I have made a split app where in master page after user clicks on the name of the user all the details are displayed in the detailsPage.This code is for the detailsPage.I'm getting the following error
TypeError: Cannot read property 'getBinding' of undefined
return Controller.extend("com.Second.SecondProject.controller.SecondPage", {
onInit: function () {
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.getRoute("DetailsPage").attachMatched(this._onObjectMatched, this);
},
_onObjectMatched: function (oEvent) {
var selectedArguments = oEvent.getParameter("arguments");
var selectedRecord = selectedArguments.value;
console.log(selectedRecord);
var oList = sap.ui.getCore().byId("UserList");
var oBinding = oList.getBinding("users");
console.log(oBinding);
var aFilter = [];
aFilter.push(new Filter("name", FilterOperator.Contains, selectedRecord));
oBinding.filter(aFilter);
// var obj = {
// "Objects": selectedRecord
// };
// var navigationobjModel = new JSONModel();
// navigationobjModel.setData(obj);
// this.getView().setModel(navigationobjModel, "users");
}
});
});