0

I'm looking for filtering just a List in Client Side and let other like table etc etc filtering in server side Is there any options to add to the list to filter in client side ? Regards

2
  • stackoverflow link Check the link, you may get any idea
    – santhosh
    Mar 31, 2017 at 11:23
  • Use a JSON Model for filtering/sorting on the client side
    – Stephen S
    Mar 31, 2017 at 14:28

2 Answers 2

1

You can use the operation mode parameter for the v2.ODataModel. This parameter can be set at model level (see the defaultOperationMode constructor parameter) or at binding level (see the operationMode constructor parameter).

Based on this parameter, the model fetches data differently:

  • Server mode: data is fetched as needed (paging, sorting and filtering is done on server side; each sorting, filtering or paging operation triggers a request).
  • Client mode: the whole collection is requested initially. All sorting, filtering and paging operations are done on the client.
  • Auto: a combination (based on other model settings).

To read more about the operation mode, check out the corresponding documentation: OperationMode.

If you want to use this only on one list, then you should you the binding variant:

<List items="{path: '/Collection', parameters: {operationMode: 'Client'}}">
    <StandardListItem title="{Field}" />
</List>
0

Serban is correct. I just add one sample code so that you can refer when you want to change all your operation on model to client mode. I looks like this:

var oModel = models.createODataModel({
        urlParametersForEveryRequest: [
            "sap-server",
            "sap-client",
            "sap-language"
        ],
        url: this.getMetadata().getConfig().serviceUrl,
        config: {
            metadataUrlParams: {
                "sap-documentation": "heading"
            },
            defaultOperationMode: sap.ui.model.odata.OperationMode.Client
        }

Pay attention to the property defaultOperationMode; you can change the mode by the property.

Cheer!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.