on 08-23-2015 9:02 AM
I just knew that using data binding with filter is not possible. But it is working when I write hard-coded word.
Is there an alternative way of using "{/lastName}" in the filter object?
Thanks in advance.
Hi Shahaleel,
You have to provide the filter value to get filter working while data binding. You can provide numerous number of filters and there is no restriction that you have to provide only one filter for one column. Consider, you wanted to filter "{/lastname}" with multiple filters, you can be able to do that. But, it is just you need to know, on what perspective the data filtering should work.
For example, you wanted to filter 'lastname' which starts with 'D' and contains letters 'ane' in the word.
Then you can say -
var oFilter1 = new sap.ui.model.Filter("lastname", sap.ui.model.FilterOperator.StartsWith, "D");
var oFilter2 = new sap.ui.model.Filter("lastname", sap.ui.model.FilterOperator.Contains, "ane");
//Data Binding Start
var oComboBox = new sap.m.ComboBox({
items: {path:"/employee/contacts", template:oItemTemplate, filters:[oFilter1,oFilter2]}
});
For more info, check the aggregation binding document -
Aggregation Binding - User Interface Add-On for SAP NetWeaver - SAP Library
Regards,
Sai Vellanki.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think you didn't get what I mean. I mean what if I want to search for something in the model, like below:
var oFilter1= new sap.ui.model.Filter("lastNameColumn", sap.ui.model.FilterOperator.Contains, "{/lastName}");
"{/lastName}" --> doesn't work but if I write the word hard-codded like "sd" it works !!!
var oView = this.getView();
var oFilter1= new sap.ui.model.Filter("lastNameColumn", sap.ui.model.FilterOperator.Contains,oView.getModel("ModelRef").getProperty('/lastName');
If no ModelRef then,
var oFilter1= new sap.ui.model.Filter("lastNameColumn", sap.ui.model.FilterOperator.Contains,oView.getModel().getProperty('/lastName');
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.