Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 Filters

0 Kudos

hi all,

i have developed a simple on SAPUI5. Data is coming from ES5 Gateway system. This app has to show the salesorder<a href="/storage/temp/1865562-output.png">output.png</a>numbers and Customers and need to filter based on Given customer. Filter Operator is not working properly. For Example if SAP Is given as customer it is showing the first 5 records instead of showing the 5 records that has SAP as customer.using the liveChange event on searchfield


onSearch: function(oEvent){
	
		var sSearchValue = oEvent.getSource().getValue(), 
		//	var sSearchValue = oEvent.getParameter("Value"),
			aFilters = []; 
			if(sSearchValue.length > 0){
				var oFilterName = new Filter("CustomerName", sap.ui.model.FilterOperator.Contains, sSearchValue); 
				var oFilterID = new Filter("SalesOrderID", sap.ui.model.FilterOperator.Contains, sSearchValue);
				aFilters.push(new Filter({filters:[oFilterID,oFilterName], And:false}));
			}
			this.getView().byId("table").getBinding("items").filter(aFilters,"Application");
5 REPLIES 5

0 Kudos

check dev console in chrome if you have errors, if salesorderid is returned as integer you cannot use contains, only EQ

sap.ui.model.FilterOperator.EQ

0 Kudos

tried with FilterOperator.EQ But no change

0 Kudos

Hi all,

when i am running the app with the same logic in controller and view what i have noticed when the app is thinking with 3 blue dots and if i put my customer query like"SAP" at that time it is showing the right results (all the customers with "SAP" are shown) but once the list is completely displayed then putting customer query in the search field it is not showing right result.

0 Kudos

I still have the same problem. My controller logic is same.But result is coming differently. If i query before the data is loaded I am getting the right result. but if i query after the data is loaded then wrong result. I have noticed the GET request is behaving differently

(Tested in the browser too)

Right data for :

https://sapes5.sapdevcenter.com/sap/opu/odata/iwbep/GWSAMPLE_BASIC/SalesOrderSet?$filter=CustomerNam...

wrong data for:

https://sapes5.sapdevcenter.com/sap/opu/odata/iwbep/GWSAMPLE_BASIC/SalesOrderSet?$count?&filter=(sub...

query-before-data-is-loaded.pngquery-after-the-data-is-loaded-in-the-app.png

Please Suggest.

0 Kudos

I have figured out the issue. in the Manifest file removed the following setting

for oData model. and it is all working fine.

"settings": { "defaultOperationMode": "Server",

"defaultBindingMode": "OneTime",

"defaultCountMode": "Request" },

Thank you,

Dipti.