Hello All,
I have a SAP UI5 View with 2 input fields, a button and a list.
My requirement is to fill up the list on button click with input from two input fields.
Data is coming from O Data Service and getting filtered based on the input field values.
Code snippet is:
var oView = this.getView();
var lv_pernr = oView.byId("IpPernr").getValue();
var lv_nachn = oView.byId("IpNachn").getValue();
var lv_vorna = oView.byId("IpVorna").getValue();
var oModel = new sap.ui.model.odata.v2.ODataModel("/sap/opu/odata/sap/name_of_service/"); this.getView().setModel(oModel);
var filters = new sap.ui.model.Filter({
and: true,
filters: [new sap.ui.model.Filter("Pernr", sap.ui.model.FilterOperator.EQ, lv_pernr),
new sap.ui.model.Filter("Nachn1", sap.ui.model.FilterOperator.EQ, lv_nachn),
new sap.ui.model.Filter("Vorna1", sap.ui.model.FilterOperator.EQ, lv_vorna)
]
});
var binding = this.byId("list").getBinding("items");
binding.filter(filters);
Is there anything wrong with my code as lv_pernr, lv_nachn, lv_vorna is not getting populated on button click even though I am giving input.