Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

typeahead search using searchField

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

Former Member
Former Member replied

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.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question