2

I'm working on a module where I need to filer store view which is stored as comma-separated values in a custom table. I tried solutions mentioned in Magento 2 -Admin Grid Select filter with comma separated values but it is not even getting into my collections file for the filter, meaning any changes in the collection (including exit() is not getting reflected). Can anyone please help here?

di.xml

        <arguments>
            <argument name="mainTable" xsi:type="string">callcenter_products</argument>
            <argument name="resourceModel" xsi:type="string">Vendor\Module\Model\ResourceModel\Products</argument>
        </arguments>
    </virtualType>
    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="callcenter_manage_products_grid_data_source" xsi:type="string">Vendor\Module\Model\ResourceModel\Products\Grid\Collection</item>
            </argument>
        </arguments>
    </type>

component (store view part alone)

            <argument name="data" xsi:type="array">
                <item name="options" xsi:type="object">\Magento\Store\Ui\Component\Listing\Column\Store\Options</item>
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">select</item>
                    <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/select</item>
                    <item name="dataType" xsi:type="string">select</item>
                    <item name="label" xsi:type="string" translate="true">Store View</item>
                    <item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
                </item>
            </argument>
        </column>

Collection.php

namespace Vendor\Module\Model\ResourceModel\Products;
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
{
    /**
     * @var string
     */
    protected $_idFieldName = 'id';
    /**
     * Define resource model
     *
     * @return void
     */
    protected function _construct()
    { exit;
        $this->_init('Vendor\Module\Model\Products', 'Vendor\Module\Model\ResourceModel\Products');
    } 

}

0

Your Answer

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