OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – How do I? Questions Pass a param to a grid query

This topic contains 2 replies, has 2 voices, and was last updated by  sndpl 10 years, 2 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
  • #35624

    sndpl
    Participant

    Hi,

    I have a positions entity that can belong to one or more categories. So on the view/update of a position I want to show a grid with the categories.

    In my position view template I have the following:

    In the widget template:

    In the controller:
    /**
    * @Route("/widget/categories/{id}", name="position_widget_categories", requirements={"id"="\d+"})
    * @Template()
    */
    public function categoriesAction(Position $position)
    {
    return ['entity' => $position];
    }

    and in my categories grid i use the following query (in datagrid.yml):

    But the :position is never replaced with the position id. I’m a missing something?

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

    Alexandr Smaga
    Participant

    Hi.

    Yes, event listener should be registered to fill value from request to query.
    SERVICE_ID:
    class: %oro_datagrid.event_listener.base_orm_relation.class%
    arguments:
    - 'position' # YOUR QUERY PARAM NAME
    - @oro_datagrid.datagrid.request_params
    tags:
    - { name: kernel.event_listener, event: oro_datagrid.datgrid.build.after.YOUR_GRID_NAME, method: onBuildAfter }

    #35626

    sndpl
    Participant

    Thanks for the quick reply, it works now!!

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

The forum ‘OroPlatform – How do I? Questions’ is closed to new topics and replies.

Back to top