0

I want to add one custom field in Product Grid UI Component where It will display some text which will fetch from Product Custom Option.

I tried lots of solution but all are for other Grid system not the Magento 2 Product Grid UI Component. I found how to add a custom image but I want to display, one of my Custom Option in the Product Grid UI Component. Please help

2
  • Share us your code please Commented Jun 13, 2016 at 7:01
  • @WicherVisser : I haven't written anything. Please let me know the way to do.
    – anjanbarik
    Commented Jun 13, 2016 at 7:12

1 Answer 1

0

as i understand from your question you want to add custom field to your Product grid. you can do that by creating custom action that have the grid. in your Grid Class while adding the columns add your render like the following

$this->addColumn( 'coulmnName', [ 'header' => __('Title'), 'renderer'=>'\path\to\your\ClassName', ] );

in your class add your stuff to render and return any data like the following

namespace your\class\path;

class ClassName extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
{

    public function __construct(
        \Magento\Backend\Block\Context $context,
        array $data = []
    )
    {
        parent::__construct($context, $data);
    }
    public function render(\Magento\Framework\DataObject $row)
    {
        //get any data from tour current Grid Column
        $data = $row->getCoulmnName();
        // do your stuff
        return $anyData;

    }

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.