OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – How do I? Questions How to get the data from Datagrid Action

This topic contains 5 replies, has 2 voices, and was last updated by  Hiro 9 years, 6 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
  • #28133

    Hiro
    Participant

    Is it possible to get the response data from “rowClicked” event so that I can set field values to a form?

    Currently I have settings like this in datagrid.yml:

    And I can see FireBug sends the request and gets the response like:

    Currently the setting in datagrid.yml is used only to show the pointer icon on hovering the row because there seems to be no way to catch the event unless you bind the extra callback and send the request by yourself to get the data as follows:

    Is there a way to define the callback when the AJAX request happened originally?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #28134

    Hiro
    Participant

    In addition to this issue. I have created a controller like:

    And that is why it gets the response.

    I wonder if you guys can change the code in:

    to enable to execute a callback function mentioned in datagrid.yml somehow.

    #28135

    Hiro
    Participant

    I updated OroCRM repository today and noticed I can no longer refer the data like:

    because “data-datagrid” is gone.

    What is the proper way to catch the rowClicked event at FrontEnd?

    #28136

    Hiro
    Participant

    I ended up using custom version of the following files (as coping them into my bundle folder and change lines):

    • vendor/oro/platform/src/Oro/Bundle/DataGridBundle/Resources/public/js/app/components/datagrid-component.js
    • vendor/oro/platform/src/Oro/Bundle/DataGridBundle/Resources/views/macros.html.twig

    I have put the example here:
    https://gist.github.com/hiro-iFactory/3e6dddfa31f6894d8d42

    I tried to amend the issue by creating an extension which provides the action as triggering rowClicked event with mediator, but my browser tries to load my javascript file from where pre-existing actions are (where orodatagrid/datagrid/action/xxxx-action.js is like http://localhost/bundles/oro/datagrid/action/frontend-action.js) even though my javascript file is loaded.

    #28137

    Hryhorii Hrebiniuk
    Participant

    Hello,

    Sorry for delay. I think the best solution for you would be to add your own grid builder to builders collection:

        In you bundle, for proper grid in datagrid.yml, add a builder as requireJSModule

        Builder’s init method will be invoked within grid building process:

    I hope, it’ll help.
    Thanks for your question.

    #28138

    Hiro
    Participant

    Thank you for the reply.

    Your solution worked. Now I can avoid using the customised version of core files.

    Thank you!

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

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

Back to top