on 03-05-2019 1:10 PM
Hi all,
I have a select dialog, where user selects multiple products as shown below:
When "OK" button is pressed, i am going to pass two values in filter- one containing userId and another containing multiple product ID's. I am not sending a back-end call for this. Just need to show data on table based on selected products.
Please suggest how this can be achieved.
Thank you.
Regards,
Saurabh.
Hi,
The logic behind this is as follows:
1.Bind the complete data with table
2.On "OK" press add all the filters like shown below:
var oFilter = [];
oFilter.push(new sap.ui.model.Filter("userid", sap.ui.model.FilterOperator.Contains, "userid123"));
oFilter.push(new sap.ui.model.Filter("productId", sap.ui.model.FilterOperator.Contains, "productId1"));
oFilter.push(new sap.ui.model.Filter("productId", sap.ui.model.FilterOperator.Contains, "productId2"));
var oBinding = sap.ui.getCore().btId("table-id").getBinding("items");
oBinding.filter(oFilter);
3.If multiple product ids are there then , you can use loop to push those into aFilter array.
Hope it will help 🙂
Best Regards,
Rajvardhan Thakare
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rajvardhan,
This is URL which i ran directly on browser:
http://netweavergateway.com:8031/sap/opu/odata/sap/ODATA_SRV/productSet?$filter=UserID eq '1234' and (ProductCode eq '1050' and
ProductCode eq '1060')
I want to implement the same in app using filter.
I am getting object object for multiple Product code.
Hi Saurabh ,
You can consider following code:
Consider that your odata model is mapped into oModel variable then add following lines of code ,
oModel.read("/productSet?$filter=UserID eq '1234' and (ProductCode eq '1050' and
ProductCode eq '1060')",{
success: function(oData){
// you can create a breakpoint here and check oData variable , you will get the result set into oData variablr
},
error: function(oError){
}
});
Hope it will help,
Thanks,
Rajvardhan Thakare
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.