1

I created a custom grid for my extension with mass action like this:

<listingToolbar name="listing_top">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="sticky" xsi:type="boolean">true</item>
        </item>
    </argument>
    <bookmark name="bookmark"/>
    <columnsControls name="columns_controls"/>
    <filters name="listing_filters"/>
    <massaction name="listing_massaction">
      <action name="sync">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="type" xsi:type="string">sync</item>
                <item name="label" xsi:type="string" translate="true">Sync</item>
                <item name="url" xsi:type="string">namespace_module/test/massSync</item>
            </item>
        </argument>
      </action>
    </massaction>
    <paging name="listing_paging"/>
</listingToolbar>

the problem is after i checked some row and click the sync massaction, the page seems not running my controller and redirecting to the same page but with url like this:

http://same_page_url/namespace_module/test/namespace_module/test/namespace_module/test/namespace_module/test/namespace_module/test/namespace_module/test/namespace_module/test/massSync

here's my Namespace/Module/Controller/Adminhtml/Test/MassSync.php:

namespace Namespace\Module\Controller\Adminhtml\Test;

use Magento\Backend\App\Action\Context;
use Magestore\Rewardpoints\Model\ResourceModel\Rate\CollectionFactory;
use Magento\Ui\Component\MassAction\Filter;
use Magento\Framework\Controller\ResultFactory;
use Magestore\Rewardpoints\Model\ResourceModel\Rate\Collection;

class MassSync extends AbstractMassAction
{

   public function __construct(
       Context $context,
       Filter $filter,
       CollectionFactory $collectionFactory
   ) {
       parent::__construct($context, $filter, $collectionFactory);
   }

   public function execute(){
     $data = $this->getRequest()->getParam();
     print_r($data);
     exit;
   }

   protected function massAction(Collection $collection)
   {
       $data = $this->getRequest()->getParam();
       print_r($data);
       exit;
   }


   protected function _isAllowed()
   {
       return $this->_authorization->isAllowed('Magestore_Rewardpoints::Earning_Rates');
   }

}
  • Can you show your routes.xml? – Sohel Rana Mar 14 '17 at 4:44
  • @SohelRana the problem is at <item name="url" xsi:type="string">namespace_module/test/massSync</item> i change it to <item name="url" xsi:type="url" path="namespace_module/test/massSync"/> but now the problem is, it wont send the id checked when i print getRequest()->getParam() – Idham Choudry Mar 14 '17 at 4:52

Your Answer

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

Browse other questions tagged or ask your own question.