Magento – How to i add select dropdown side of Mass action Button In Magento 2 Admin Side

admindrop-downsgridmagento2select

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.enter image description here
Thanks In advance.

Best Answer

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?',
    ));
}
Related Topic