OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – Programming Questions Datagrid Choice Filter Contains/With Wildcard

This topic contains 2 replies, has 2 voices, and was last updated by  archy_bold 7 years, 10 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #34170

    archy_bold
    Participant

    Hi there.

    I’m trying to set up a datagrid choice filter for one of my columns, I’ve had no issues doing this in the past, but what I want to do differently this time is not match the string exactly, but match with a wildcard. I have the following filter:

    Which works fine for any status of ‘Finished.Completed’ or ‘Finished.Failed’ as these can match my status exactly. The issue comes with the ‘Shopping’ status, which can be ‘Shopping.Ongoing’ or ‘Shopping.Checkout’. Basically I want to match anything that starts with ‘Shopping’.

    I’ve tried various things but the documentation is really lacking for the choice filters. Any tips on how to achieve this? Do I need to write a custom filter?

    Thanks,
    Simon

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #34171

    Mike Kudelya
    Participant

    Hi,

    Yes, you can create new custom filter, for example (If you didn’t create our custom bundle, create it and extend from FilterBundle):

    Create custom Custom/Bundle/FilterBundle/Filter/SelectLikeFilter.php:

    Register it in Custom/Bundle/FilterBundle/Resources/config/services.yml:

    Create js file Custom/Bundle/FilterBundle/Resources/public/js/filter/select-like-filter.js:

    Register js file in Custom/Bundle/FilterBundle/Resources/config/requirejs.yml:

    Don’t forget run these commands:

    Now you ready to change your filter type from choice to select-like and use “Shopping.%”: Shopping options

    #34172

    archy_bold
    Participant

    Brilliant! It works with a couple of modifications to SelectLikeFilter. Just with an extra use for FilterUtility and with wildcards round the $value when setting the query parameter. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.

Back to top