OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – How do I? Questions Array as a data source for Datagrid

This topic contains 4 replies, has 2 voices, and was last updated by  Madhur 8 years ago.

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

  • Creator
    Topic
  • #36192

    Madhur
    Participant

    Hi,

    I have to write some complex queries for some reports. It involves little bit complex calculation and radian queries. So I was thinking if I can write a query in the controller and assign the resulting array to a datagrid.

    Is it possible to assign an array as a datasource to a datagrid? I saw in the documentation that datagrid can retrieve data from different sources (orm, dql, array, etc). But only ORM is implemented.

    So how do I assign an array as a datasource to a datagrid?

    Thanks and Regards,
    Madhur

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #36193

    Yevhen Shyshkin
    Participant

    Hello.

    First solution – you can implement all required components (datasource, sorter, filters, pager etc) to support array usage. For example, see grid implementation for search engine.

    Second solution – you can use existing ORM implementation for basic query, and then add calculated fields via listener. In this case you still have ORM-based grid with dynamically added columns.

    Third solution – you can simply render grid as plain HTML, not as JS grid component. Feel free to use existing CSS classes.

    #36194

    Madhur
    Participant

    Hi Yevhen,

    I know I am going to ask something that is not particularly OroCRM, but I found that there is a symfony grid called APYDataGridBundle and it seems to have all the features that OroCRM DataGrid has including filters and sorting.

    When I try to use it in a twig template that is extended from OROUIBundle:actions:index.html.twig and use the following code I get an error: A template that extends another one cannot have a body

    When I change the code to the following I don’t get any error but the grid is not displayed.

    What do I have to do to get the grid displayed? If I use it without extending the OROUIBundle then I don’t get any headers and menus are all gone.

    Please help me with this. I will be forever grateful.

    Thanks and Regards,
    Madhur

    #36195

    Yevhen Shyshkin
    Participant

    If you are trying to use grid defined using APYDataGridBundle – you should check its documentation and code, and then find out why it’s not working. Good place to start is browser console (JS errors) and logs from php and web-server (PHP errors).

    If you trying to use OroCRM grid definition with grid from APYDataGridBundle then they will not work because their interfaces are incompatible.

    #36196

    Madhur
    Participant

    Hi Yevhen,

    Thanks for the tip. It just follows a block scheme that I had to follow.

    Thanks for the support, you guys are really great and also creating a great product.

    Regards,
    Madhur

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

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

Back to top