So löschen Sie eine einzelne Reihe aus dem Gitter in Magento

<?php
namespace Vendor\Module\Controller\Adminhtml\Module;

use Magento\Backend\App\Action;
use Magento\TestFramework\ErrorLog\Logger;

class DeleteRow extends \Magento\Backend\App\Action
{

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

    
    public function execute()
    {
        $id = $this->getRequest()->getParam('id');
        $resultRedirect = $this->resultRedirectFactory->create();
        if ($id) {
            try {
                $model = $this->_objectManager->create('Vendor\Module\Model\Module');
                $model->load($id);
                $model->delete();
                $this->messageManager->addSuccess(__('The Record has been deleted.'));
                return $resultRedirect->setPath('*/*/');
            } catch (\Exception $e) {
                $this->messageManager->addError($e->getMessage());
                return $resultRedirect->setPath('*/*/edit', ['entity_id' => $id]);
            }
        }
        $this->messageManager->addError(__('We can\'t find a row to delete.'));
        return $resultRedirect->setPath('*/*/');
    }
}
?>
Dharmesh Tukadiya