0

In magento2, how to hide a ui-component grid row when the status is "New" in admin.

enter image description here

etc\di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="vendor_module_index_listing_data_source" xsi:type="string">Vendor\Module\Model\ResourceModel\Enquiry\Collection</item>
            </argument>
        </arguments>
    </type>
    <virtualType name="Vendor\Module\Model\ResourceModel\Enquiry\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
        <arguments>
            <argument name="mainTable" xsi:type="string">vendor_module</argument>
            <argument name="resourceModel" xsi:type="string">Vendor\Module\Model\ResourceModel\Enquiry</argument>
        </arguments>
    </virtualType>
</config> 

Vendor\Module\ResourceModel\Enquiry\Collection

<?php

namespace Vendor\Module\ResourceModel\Enquiry;

class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
{

    protected $_idFieldName = 'enquiry_id';
    protected $_eventPrefix = 'vendor_module_enquiry_collection';
    protected $_eventObject = 'enquiry_collection';

    /**
     * Define resource model
     *
     * @return void
     */
    protected function _construct()
    {
        $this->_init('Vendor\Module\Model\Enquiry', 'Vendor\Module\Model\ResourceModel\Enquiry');
    }
}

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.