cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 Add Custom Grid in Custom Form Tabs in Admin

Magento 2 Add Custom Grid in Custom Form Tabs in Admin

I am trying to add custom grid on custom tabs in admin. This is my file that is under Tab folder that is causing issue.

namespace Vendor\Warranty\Block\Adminhtml\Warrantydetails\Edit\Tab;
    use Magento\Backend\Block\Widget\Tab\TabInterface;
    class Warrantyrule extends \Magento\Backend\Block\Widget\Grid\Container implements TabInterface
    {
    protected function _construct()
     {
         $this->_controller = 'adminhtml_warrantydetails';
         $this->_headerText = __('Warranty Rules');

         if ($this->_model->getId()) {
             $this->_addButtonLabel = __('Add New Rule');
             $this->addButton(
                 'add_new',
                 [
                     'label' => $this->getAddButtonLabel(),
                     'onclick' => 'setLocation(\'' . $this->getCreateUrl() . '\')',
                     'class' => 'add primary'
                 ],
                 0,
                 0,
                 $this->getNameInLayout()
             );
         }


         $this->removeButton('add');
     }
    }

But this is causing issue. The Page is blank and in system.log there is and error
Class Magento\Backend\Block\Adminhtml\Warrantydetails\Grid does not exist
I think the issue is because of $this->_controller = 'adminhtml_warrantydetails';