cancel
Showing results for 
Search instead for 
Did you mean: 

typeahead search using searchField

Former Member
0 Kudos

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

View Entire Topic
former_member183518
Active Participant
0 Kudos

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.

Former Member
0 Kudos

Thanks Sakthivel.

But I do have huge set of data with me.

Will the same approach work for that.

Regards,

Ajay