ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 2 replies, has 2 voices, and was last updated by  archy_bold 1 year, 5 months ago.

  • Creator
    Topic
  • #20064

    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
  • #20075
    Mike Kudelya
    Mike Kudelya
    Oro Core

    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

    #20089

    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)

You must be logged in to reply to this topic.