As I see by default once magento2 mass action applied, default logic is to refresh the page. I would like to have grid refreshing without actual page reload but rather from js once massaction completed. I have successfully refershed grid once I add new item with my custom scripts using js, however I can't find way easy way to call js for massaction and as far as I see for massaction magento2 just doing redirect to the actual controller page there action happen.
Here's part of my listing grid for massdelete (working just fine but with page refresh)
<action name="massdelete"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="type" xsi:type="string">massdelete</item> <item name="label" xsi:type="string" translate="true">Delete</item> <item name="url" xsi:type="url" path="electroidlab/connect_ui/massDelete"/> <item name="confirm" xsi:type="array"> <item name="title" xsi:type="string" translate="true">Attention</item> <item name="message" xsi:type="string" translate="true">Are you sure want to delete?</item> </item> </item> </argument>
Here's part of the controller with redirect. If I comment redirect part, then it will be just white page with controller path in url
public function execute() { ... $collection = $this->filter ->getCollection( $this->collectionFactory->create() ); $catRecordDeleted = 0; foreach ($collection as $category) { $category->setId($category->getEntityId()); $category->delete(); ++$catRecordDeleted; } $this->messageManager->addSuccess( __("A total of %1 record(s) have been deleted.", $catRecordDeleted) ); return $this->resultRedirectFactory->create()->setPath( 'electroidlab/connect/edit', [ 'id'=>$this->getRequest()->getParam('id'), '_secure' => $this->getRequest()->isSecure() ] ); ... }
Is there a way to make default massaction without actual page refresh? Thanks!