on 01-12-2015 10:39 AM
Hi Experts,
I want to know how to filter data more than 2 values..i can able to filter single property data..but i want to search all fields data.
I used below code:
search: function(oEvent)
var SamTbl = oEvent.getParameter("newValue");
var filters = new Array();
var oFilter = new sap.ui.model.Filter("Name", sap.ui.model.FilterOperator.Contains, SamTbl);
// var oFilter1 = new sap.ui.model.Filter("Age", sap.ui.model.FilterOperator.Contains, SamTbl);
filters = (oFilter);
var listItem = sap.ui.getCore().byId("oTable");
var binding = listItem.getBinding("items");
binding.filter(filters);
can you please say here where i can make change to filter all fields data.
Thanks & Regards,
Palsaran
Hi Pal
You're very close. Code should be
var contains = sap.ui.model.FilterOperator.Contains;
var filters = new sap.ui.model.Filter([
new sap.ui.model.Filter("Name", contains, SamTbl),
new sap.ui.model.Filter("Age", contains, SamTbl)],
false); // false for OR
OR
var contains = sap.ui.model.FilterOperator.Contains;
var columns = ['Name', 'Age', "Column1', ColumnX', ColumnY'];
var filters = new sap.ui.model.Filter(columns.map(function(colName) {
return new sap.ui.model.Filter(colName, contains, SamTbl); }),
false);
-D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.