OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – Programming Questions Filters for dynamic columns DataGrid

This topic contains 1 reply, has 2 voices, and was last updated by Yevhen Shyshkin Yevhen Shyshkin 2 years, 9 months ago.

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

  • Creator
  • #37932


    Hello everyone
    I need to add filter for dynamic column in my DataGrid. The column and it’s filter is added to my DataGrid by listener on the “onBuildAfter”, and the data is added in the “onResultAfter”.

    Thanks :)

Viewing 1 replies (of 1 total)
  • Author
  • #37934
    Yevhen Shyshkin
    Yevhen Shyshkin

    Hello Shomeis.

    If you want to add column and filter it is better to use onBuildBefore event. There is another issue though – filters (and sorters) work on the main datagrid query only. In other words, it is not enough to mix your data using onResultAfter event to allow filter work with it – you have to make sure that this data is presented in the DB query.

    Usually it’s done using additional join to a required entity and added required parts to select, columns, filters and sorter sections of the datagrid. Here is an example: https://github.com/oroinc/orocommerce/blob/3.1.0-rc/src/Oro/Bundle/TaxBundle/EventListener/TaxCodeGridListener.php#L38-L47

    Please let me know if you still have some questions.

Viewing 1 replies (of 1 total)

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

You will be redirected to [title]. Would you like to continue?

Yes No