5

i updated from Magento 2.3.2 to 2.3.3, and one module has a problem with grid massactions.

The old way was:

            <action name="change_status">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="type" xsi:type="string">change_status</item>
                    <item name="label" xsi:type="string" translate="true">Change Status</item>
                    <item name="urlPath" xsi:type="string">company_module/customerchange/changeStatus</item>
                    <item name="paramName" xsi:type="string">status</item>
                </item>
            </argument>
            <argument name="actions" xsi:type="configurableObject">
                <argument name="class" xsi:type="string">Company\Module\Ui\Component\MassAction\ChangeStatus</argument>
                <argument name="data" xsi:type="array">
                    <item name="urlPath" xsi:type="string">company_module/customerchange/changeStatus</item>
                    <item name="paramName" xsi:type="string">status</item>
                    <item name="confirm" xsi:type="array">
                        <item name="title" xsi:type="string" translate="true">Confirm</item>
                        <item name="message" xsi:type="string" translate="true">Are you sure to change the status?</item>
                    </item>
                </argument>
            </argument>
        </action>

After update i get the error message: Exception #0 (InvalidArgumentException): Class argument is invalid: Company\Module\Ui\Component\MassAction\ChangeStatus

The code above was the only i found. Is there another right way to do this? Or is there an error in my code?

Regards, Andreas

5

You should change your code using example from any magento 2.3 listing, for example you can use the customer group change action in the customer grid:

See source model here:
vendor/magento/module-customer/Ui/Component/MassAction/Group/Options.php

In vendor/magento/module-customer/etc/di.xml added some params:

    <type name="Magento\Customer\Ui\Component\MassAction\Group\Options">
        <arguments>
            <argument name="data" xsi:type="array">
                <item name="urlPath" xsi:type="string">customer/index/massAssignGroup</item>
                <item name="paramName" xsi:type="string">group</item>
                <item name="confirm" xsi:type="array">
                    <item name="title" xsi:type="string" translatable="true">Assign a Customer Group</item>
                    <item name="message" xsi:type="string" translatable="true">Are you sure to assign selected customers to new group?</item>
                </item>
            </argument>
        </arguments>
    </type>

Finally, in
vendor/magento/module-customer/view/adminhtml/ui_component/customer_listing.xml

            <action name="assign_to_group">
                <settings>
                    <type>assign_to_group</type>
                    <label translate="true">Assign a Customer Group</label>
                    <actions class="Magento\Customer\Ui\Component\MassAction\Group\Options"/>
                </settings>
            </action>

P.S. This example code is compatible with magento 2.2.x

  • Thank you, that worked. I found that in the customer module, but i did not know that there was a entry in di.xml, too. Thank you very much :) – Andreas Oct 10 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.