OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – Programming Questions Same datagrid with different parameters on one page

This topic contains 6 replies, has 2 voices, and was last updated by  andesk 6 years ago.

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

  • Creator
  • #33468


    Hi all! :)

    I run into an issue regarding using the *same* datagrid with different request parameters on a single page after updating OroPlatform from 1.2 to 1.3: the displayed data inside *all* datagrids (of same type) is always the data from the *first* datagrid that is rendered. It seems that something important has been changed here that makes this use case impossible. Did those changes happen on purpose?

    Use case: I am “grouping” entities by timeframes and using multiple datagrids for that. One datagrid for “current month”, one for “last month” and one for “all months mefore”. I introduced a custom parameter and registered filter listener via DIC and then calling dataGrid.renderGrid() multiple times in twig template with different parameters. Worked like a charm in 1.2 but now… Probably the data is “cached” somehow in memory? Maybe a “sub service” is shared between datagrid “instances” when calling getData() method?

    Is this a bug? Should I create a bug report on github? Or is using multiple datagrids of same type not supported anymore?

    Thanks for help/answer! :)

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
  • #33469


    Addition: the different database queries for the different request parameters of the datagrids are *all* executed (shown in profiler). So they are executed, but not used?! That sounds like a bug to me then…



    Next addition: the json encoded data of datagrid is correctly stored in “data-data” attribute of the rendered datagrid div container. So it’s just something in javascript rendereing logic. Have not found the soruce yet, though, help appriciated :)



    Ok, I found the issue source now: https://github.com/orocrm/platform/commit/d3a8af60f0ca75c2aa99a45ce8542f08d77299d8#diff-f3a1599d7bc6cb3f9149209d2436323f

    In file src/Oro/Bundle/DataGridBundle/Resources/public/js/datagrid-builder.js and lines 90 and following:

    As the gridName is used as only “identifier” for that “caching” in gridContentManager, it returns the same collection data for every reuse of the same grid type.

    => The identifier should be changed to something more unique. For example the grid’s selector (as this one is including a random value as postfix) or to be more precise, even include a serialized string of all given parameters of dashboard?



    Hm. In master branch, the datagrid-builder.js does not exist anymore…


    Alexandr Smaga

    Hello @andesk!

    Yes, you are right!
    This is caching issue that we aware of. Fix will be included in the nearest release. If this issue blocks you we can prepare a patch.

    Thanks for the investigation!



    Thanks for the reply. Is there a bug ticket for it so I can check the status?

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

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

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

Yes No