0

There is an admin grid created in block method. Now I want to add a new column with a button or link that will open a popup when clicked. So instead of having the edit/view link that redirects to another page I could view the required details inside the popup on the same page. Is there any easy method to achieve this feature? The existing columns are added in the _prepareColumns function as below,

protected function _prepareColumns()
{
    $this->addColumn(
        'user_id',
        [
            'header' => __('Seller ID'),
            'type' => 'number',
            'index' => 'user_id',
            'header_css_class' => 'col-id',
            'column_css_class' => 'col-id'
        ]
    );
    $this->addColumn(
        'view', [
        'header' => __('Show more'),
        'type' => 'action',
        'actions' => [
            [
                'caption' => __('Show more'),
                'url' => [
                    'base' => '',
                ],
                'field' => ''
            ]
        ],
        'filter' => false,
        'sortable' => false,
        'index' => 'user_id',
        'header_css_class' => 'col-action',
        'column_css_class' => 'col-action'
    ]);
    $this->addColumn(
        'seller_name',
        [
            'header' => __('Seller Name'),
            'index' => 'user_id',
            'filter' => false,
            'renderer' => 'MyVendor\MyModule\Block\Adminhtml\Grid\Column\SellersGridSellerName'
        ]
    );
    $this->addColumn(
        'seller_state',
        [
            'header' => __('State/Province'),
            'index' => 'state',
            'type'   => 'text',
        ]
    );
    $this->addColumn(
        'seller_status',
        [
            'header' => __('Seller Status'),
            'index' => 'userstatus',
            'type' => 'options',
            'options' => array(
                '1'=>'Active',
                '2'=>'Deactivated',
                '0'=>'Pending'
            ),
            'renderer' => 'MyVendor\MyModule\Block\Adminhtml\Grid\Column\SellersGridSellerStatus'
        ]
    );
    $block = $this->getLayout()->getBlock('grid.bottom.links');
    if ($block) {
        $this->setChild('grid.bottom.links', $block);
    }

    return parent::_prepareColumns();
}  

Now I would like to open a popup when clicked on 'Show more' link to show more information about the seller. Please let me know if there is a way. Thank you in advance!

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.