cancel
Showing results for 
Search instead for 
Did you mean: 

oList is changed after applying Filter

Former Member
0 Kudos
733

Hi Team,

I am facing a weird issue. I have a table with JSON model and data is retrieveing during Init of the application. I have a custom filter for the table. When I enter the value it is filtering the values properly for the first time. on the second time when I do it, it always filters based on the filtered value and not the original model.

Upon checking thethis.getView().byId(tabname).getBinding("items"), I found that oList is getting refreshed with filtered values.

Could you please provide some hints on this behaviour and how to stop it?

The logic to filter is working for other table in the same application. Just one table is causing issue...

My code to filter.

var oFilter = null ; 

if (fValue) 

{ oFilter = new sap.ui.model.Filter("ColumnA", sap.ui.model.FilterOperator.Contains, fValue); } 

var binding = this.getView().byId("Table1").getBinding("items"); 

binding.filter(oFilter,sap.ui.model.FilterType.Application); 

binding.refresh(true);

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Issue resolved. The problem was with setting the count of the icontabfilter. When setcount method is used to show the updated result, it creates the above issue. Removed the code and coded differently to show the filtered result count.

Answers (1)

Answers (1)

former_member365727
Active Contributor
0 Kudos

why are you using filtertype as 'Application'?

change filter type from 'Application' to 'Control', it should work fine.

binding.filter(oFilter, sap.ui.model.FilterType.Control);

Application filter: When a set of entries is filtered using Application filter then the filter stays on until the application is terminated or closed. Eg: For a list of 100 items application filter is applied....assuming this results output of 80 entries. Now another application filter or second time filter is applied....in this case previous application filter and the current application filter are applied which results in applying new application filter on 80 entries.

Control Filter: Everytime a new control filter is applied...then previous control filter is over written. Considering the previous example on filtering first time we have 80 items....then on re-applying a different filter system clears of old filters and applies the current filter only......this results in applying current filter on 100 items.