OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

This topic contains 7 replies, has 2 voices, and was last updated by Yevhen Shyshkin Yevhen Shyshkin 5 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
    Topic
  • #33646
    infocurci
    infocurci
    Participant

    Hello,
    I need of create a custom mass action on my datagrid.
    On DataGridBundle/Resources/doc/backend/extensions/mass_action.md
    I read “**@TODO create doc**” :(
    There is some bundle that I can see for a simple example?
    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #33647
    Yevhen Shyshkin
    Yevhen Shyshkin
    Participant

    Hello, infocurci.

    Sorry for inconvenience with the doc, we’ll update it ASAP.

    You can look at delete mass action and it’s usage in contacts grid.

    #33648
    infocurci
    infocurci
    Participant

    Hello,
    thanks for your reply.
    I read the example and I created my mass action action on datagrid, that calls a function on controller. It works fine but the application fails on return response, I don’t know what type of response the function must return.
    If I return an array json:

    it load an empty page.
    I need to reload same page, with datagrids (I have 2 datagrid) updated… or better, reload only datagrids.

    #33649
    Yevhen Shyshkin
    Yevhen Shyshkin
    Participant

    Look’s like response is correct. Please, check for JS errors and try to debug Oro/Bundle/DataGridBundle/Resources/public/js/datagrid/action/mass-action.js (this file handles mass action processing on JS) – probably, it’s either didn’t initialized correctly, or there is an error in processing.

    I assume that you are using ajax mass action – so, you can debug delete mass action on contacts grid and compare with your processing.

    Also you can check whether custom controller action is really required in your case – if no then you can create only handler and use default mass action controler action.

    #33650
    infocurci
    infocurci
    Participant

    Hello,
    the script, now, works fine.
    The mass action, after return “Success” reply, print a message on top of page and reload the datagrid. So far, so good!
    My page is made of 2 datagrids, and I need reload also the other grid.
    It’s possible?
    If not, is possible reload entire page after datagrid return reply?

    #33651
    Yevhen Shyshkin
    Yevhen Shyshkin
    Participant

    1) You have to create custom JS mass action and refresh your second grid in this method.

    2) You can use redirect action insted of ajax actions and redirect to the same page.

    IMHO, first solution is more clear and better.

    #33652
    infocurci
    infocurci
    Participant

    Hello,
    I extended the action with my custom action and it works (if, on event “_onAjaxSuccess”, I add a javascript fake message with alert() function, it appears).
    Anyway, I don’t know how refresh another datagrid from this function..

    #33653
    Yevhen Shyshkin
    Yevhen Shyshkin
    Participant

    To refresh a grid you have to inject mediator module via requirejs (oroui/js/mediator) and trigger event "datagrid:doRefresh:<gridName>". Here is example for customer orders grid: mediator.trigger(&quot;datagrid:doRefresh:magento-customer-orders-widget-grid&quot;);

    Also you can look at this example – it does exactly what you need.

Viewing 7 replies - 1 through 7 (of 7 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