on 10-12-2015 5:18 AM
Hello,
We are creating a custom SAPUI5 master-detail application.
For master list, we have put a searchfield containing multiple filters, which works fine using oData model.
But with oData model, search string response time is slower, as it goes to back end for every search character.
We have tried with json model for the same, and it works as expected i.e. we can search the data locally.
But for json model to work, we had to attach the json model to master view, then we were able to search locally.
Can we set the oData model at launch of application to master view, and a local json model for searchField control.
I have tried with creating a json model in onAfterRendering function in master controller and setting the same model to searchField control.
But the searchField still calls the back end i.e the oData model.
Seeking help.
Regards,
Ajay Kulkarni
If you don't have a huge set of data to load and want the filter to be processed in the client side, you can use V2 odata model with operationMode 'client'.
new sap.ui.model.odata.v2.ODataModel(<url>,{defaultOperationMode:"Client"});
As an alternative instead of defining the whole model instance as Client mode, you can also specify the appropriate list binding alone in Client mode.
oList.bindItems({
path : "/entitySet",
parameters : {
operationMode : "Client"
}
});
https://sapui5.hana.ondemand.com/#docs/api/symbols/sap.ui.model.odata.v2.ODataModel.html
With this you don't have to manually create a json model from your odata just for client side filtering.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ajay,
Can you share the code of Master view and controller.
Thank you!
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.
Hi Ajay,
By default JSON model has two way binding. please change that mode to one way binding.
var oModel = new sap.ui.model.json.JSONModel();
oModel.setDefaultBindingMode(sap.ui.model.BindingMode.OneWay);
JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.model.BindingMode
Thanks,
Karthik A
Could you please help me in this.
Regards,
Ajay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.