cancel
Showing results for 
Search instead for 
Did you mean: 

filter method of sap.ui.model.binding

0 Kudos

hello everyone,i hava a problem when i write follow code;


var oList=this.getVIew().byId("list");

var oBinding=oList.getBinding("items");

oBinding.filter(aFilters);

i hava searched API for  "sap.m.List", and found method "getBinding",the method return "sap.ui.mode.Binding";

then i searched API for sap.ui.model.Binding, but i cant not find the method of filter,does anyone know something about it?

Accepted Solutions (1)

Accepted Solutions (1)

saivellanki
Active Contributor
0 Kudos

Hi LAN,

Check this sample: SAPUI5 Explored

And Code here: SAPUI5 Explored

Regards,

Sai Vellanki.

0 Kudos

thank you for your response,but my problem is that i can not find the "filter" method of sap.ui.model.Binding.i only see the example in EXPLORE used this method,but how can i know what method a control have by using API?

thank you again

karthikarjun
Active Contributor
0 Kudos

Hi Lan,

The Binding is the object, which holds the necessary information for a data binding, like the binding path and the binding context, and acts like an interface to the model for the control, so it is the event provider for changes in the data model and provides getters for accessing properties or lists.

Filter: It is a Javascript core property to filter the item from an array.

For ex:

The filter() method returns elements that match a certain criteria.

This method lets you specify a criteria. Elements that do not match the criteria are removed from the selection, and those that match will be returned.

This method is often used to narrow down the search for an element in a group of selected elements.

Tip: The filter() method is the opposite of the not() method.

Thanks,

KA

saivellanki
Active Contributor
0 Kudos

Hi LAN,

Not sure, why it is not documented in sap.ui.model.Binding . Since, it is a abstract class I checked the base class sap.ui.model: JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.model

And there is a List Binding, where this .filter() method is available: JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.model.ListBinding

Regards,

Sai Vellanki.

former_member182372
Active Contributor
0 Kudos

sap.ui.model.Binding does NOT have filter method

former_member182372
Active Contributor
0 Kudos

filter would make sense only for list binding, and sap.ui.model.Binding is a superinterface for PropertyBinding and Listbinding, so - no filter in super interface

saivellanki
Active Contributor
0 Kudos

Makism,

Now it sounds *Crystal Clear* to me!

Thank you for sharing it.

Regards,

Sai Vellanki.

Answers (2)

Answers (2)

former_member182372
Active Contributor
0 Kudos

and yes, sdk's api reference is not full, that's why i encourage all develeoprs to go and check sources

former_member182372
Active Contributor
0 Kudos

you dont see it because it is ListBinding

SAPUI5 SDK - Demo Kit

0 Kudos

yes,you are right,i also wonder that it returns ListBinding when i can not find filter in Binding but find in ListBinding.i am new to js ,i can not make sure it is a ListBinding when i debug,can you tell me how to distinguish it?