Generate oData filter string from standard filters

Posted by: seaninglis on 13 November 2023, 3:38 am EST

  • Posted 13 November 2023, 3:38 am EST

    I have a requirement to generate the oData

    $filter
    expression that would be used as a result of applying a set of local grid filters, but I am not binding to any oData data source at the point I’d like to get the expression.

    Is there any utility call I can make that will take a set of filter expressions - or a filter control - and generate the equivalent $filter expression for storing and later use?

  • Posted 13 November 2023, 4:59 pm EST

    Hi,

    As per your use case, you can create a custom function that can generate the desired filter string as per the filter conditions or values.

    Please refer to this demo sample that creates a filter string from the condition set in the FlexGridFilter: https://developer.mescius.com/wijmo/demos/Core/CollectionView/RestCollectionView/OData

    Also, to get the filter string for the current applied filters you may use the filterDefinition property of the ODataCollectionView class. Please refer to this link for more information: https://developer.mescius.com/wijmo/api/classes/wijmo_odata.odatacollectionview.html#filterdefinition

    Please refer to this sample for reference: https://stackblitz.com/edit/js-ntxgsg

    Regards

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels