I would like to get the select dropdown button on the side of Action Dropdown,for my custom grid collection at admin end, how can i achieve it,I would like to display the same dropdown beside. For more info please find the below screen shot. Thanks In advance.
2 Answers
You can try to add the function below in your module block grid:
protected function _prepareMassaction()
{
$this->setMassactionIdField('post_id');
$this->getMassactionBlock()->setFormFieldName('post_ids');
$this->getMassactionBlock()->addItem('delete', array(
'label' => 'Delete',
'url' => $this->getUrl('*/post/massdelete'),
'confirm' => 'Are you sure?',
));
}
You must create in your module a UI view/adminhtml/ui_component/product_listing.xml
<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<listingToolbar name="listing_top">
<massaction name="listing_massaction">
<action name="your_action">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="type" xsi:type="string">your_action</item>
<item name="label" xsi:type="string" translate="true">Your Action</item>
<item name="url" xsi:type="url" path="catalog/product/yourAction"/>
</item>
</argument>
</action>
</massaction>
</listingToolbar>
</listing>
After created UI, you must create the controller catalog/product/yourAction