on 05-17-2017 9:15 PM
Hi Gurus
I am quite new on UI5, I am developing a page to show a list using OData & XML View.
It works fine if I retrieve the whole data set and do filtering at the frontend.
But, I want to do filtering at the backend before the data passing to the browser to save bandwidth, how can I do that?
Below is the code I am using now:
Create and bind data model:
var sInvStockUrl = "/sap/opu/odata/SAP/Z_XXXX_SRV/";
//create model
var oStockModel = new ODataModel(sInvStockUrl,"stockModel");
//set model
this.getView().byId("stockList").setModel(oStockModel,"stockModel");
Filtering when I click a button:
//create filters
var aFilter = [];
aFilter.push(new Filter("Field1", FilterOperator.EQ, "AAA"));
aFilter.push(new Filter("Field2", FilterOperator.EQ, "BBB"));
//apply filters
var oTable = this.getView().byId("stockList");
oTable.getBinding("items").filter(aFilter);
Thanks in advance!
what is the issue you are facing now?, ur code seems to be fine... do u want to know what the code to be written in odata layer?
If yes, you need to use the filter the data in getentityset method(you will find an importing filters parameter)
Best Regards,
Mahesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
do some google please
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.