5

I have followed this solution Magento 2 : How to add a product grid in custom module using ui component? but i am getting this

enter image description here

What i am doing wrong can any one help me on this. Edit Controller

class Edit extends Action
{

protected $resultRawFactory;

/**
 * @var \Magento\Framework\View\LayoutFactory
 */
protected $layoutFactory;

public function __construct(
    Action\Context $context,
    \Magento\Framework\Controller\Result\RawFactory $resultRawFactory,
    \Magento\Framework\View\LayoutFactory $layoutFactory
)
{
    parent::__construct($context);
    $this->_outfitFactory = $celebrityFactory;
    $this->resultRawFactory = $resultRawFactory;
    $this->layoutFactory = $layoutFactory;
}

/**
 * Execute action based on request and return result
 *
 * Note: Request will be added as operation argument in future
 *
 * @return \Magento\Framework\Controller\ResultInterface|ResponseInterface
 * @throws \Magento\Framework\Exception\NotFoundException
 */
public function execute()
{
    try {
        $resultRaw = $this->resultRawFactory->create();
        return $resultRaw->setContents(
            $this->layoutFactory->create()->createBlock(
                'Allure\Celebrities\Block\Adminhtml\Products\Edit\Tab\Product',
                'category.product.grid'
            )->toHtml()
        );  

    }
    catch (\Exception $exception) {
        $this->messageManager->addErrorMessage($exception->getMessage());
    }
    $this->_redirect("*/celebrities/index");
    return;
}

protected function _initItem($getRootInstead = false)
{
    $id = (int)$this->getRequest()->getParam('id', false);
    $myModel = $this->_objectManager->create('Allure\Celebrities\Model\Celebrity');

    if ($id) {
        $myModel->load($id);
    }

    $this->_objectManager->get('Magento\Framework\Registry')->register('item', $myModel);
    $this->_objectManager->get('Magento\Framework\Registry')->register('my_item', $myModel);
    $this->_objectManager->get('Magento\Cms\Model\Wysiwyg\Config');
    return $myModel;
}


}
2
  • I think the css file of page is not coming. Can you check the console and also try running content deploy, cache and indexing commands Commented May 9, 2019 at 7:07
  • Try this, it seems to be working webspeaks.in/2016/05/… Commented May 9, 2019 at 7:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.