OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – Programming Questions Adding context filter to datagrid.

This topic contains 1 reply, has 2 voices, and was last updated by  igalayev 6 years, 1 month ago.

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

  • Creator
    Topic
  • #25535

    czaros45
    Participant

    Hello everyone,

    I’ve got the following issue. I would like to add option of filtering records by contexts’ names added to each of them.
    I’ll explain it on example of Call grid. We have specified option(in yaml datagrid definition):

    When datagrid has this options specified, datagrid listener ContextGridListener.php is called. It adds to each record its contexts’ content. Now I would like to add filter called “contexts” that makes it possible to filter by these contexts’ names. The only way I see is through datagrid listener but I’m not sure how it can be done and on which event(onBuildAfter, onBuildBefore) should I call it. Is there any other solution that I missed?

    Thank you from your answers in advance.
    Greetings.

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #25536

    igalayev
    Participant

    Hi, to implement your idea about filtering records by listener you need to use OrmResultAfter event and modify results data based on context.

    Please note that contexts are handled by ActivityManager.
    You can use ActivityManager::addFilterByTargetEntity() method to filter by a given target.
    See ActivityGridListener from OroCalendarBundle as a reference.

Viewing 1 replies (of 1 total)

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

Back to top