Skip to Content
0
Jan 10, 2020 at 01:52 AM

Custom library: Filter is applied only to visible records

44 Views

Hi experts,

My motivation is to create a custom library which has reusable search helps.

This time, I have created a custom library which contains table select dialog for country codes.

The problem is, when I try to apply filter on the table, the filter is applyed only to those records which are visible in the table.

For example, when I first search with 'JP', it is not shown because JP is not yet visible in the list.

Next, I scroll down and make JP visible. Now, I can filter by JP.

initial-state.png

search-by-jp.png

display-jp.png

search-by-jp-2.png

The code to apply filter is below

		onSearch : function (oEvent) {
			var aFilter = [],
				sQuery, oBinding;
			
			sQuery = $.trim(oEvent.getParameter("value"));
			
			if (sQuery) {
				aFilter.push(new Filter("Landx", FilterOperator.Contains, sQuery));				
			}
			//oBinding.filter([oFilter]);
			oBinding = oEvent.getSource().getBinding("items");
			oBinding.filter(aFilter);		
		},

I found in the debugger that $batch response contains expected record, but it is not reflected to the table.

I also confirmed that the same code is working fine when I implement a table select dialog within a application (not using library) so I can say this is not caused by the back-end OData service.

FYI.

I have implemented the custome library referring to below information.

https://www.nabisoft.com/tutorials/sapui5/implementing-re-use-components-in-sapui5-libraries-and-consuming-them-in-sapui5-apps

Attachments

initial-state.png (23.0 kB)
search-by-jp.png (6.6 kB)
display-jp.png (22.1 kB)