Skip to content

Magento 2 Add Store View Switcher Filter in UI Component Admin Grid

enter image description here

I have created one grid that needs to apply the store view Switcher Filter it was displayed but when I click on apply filter it throws the below error.

Integrity constraint violation: 1052 Column ‘store_id’ in where clause is ambiguous.

This Error comes because the store_id column is available on so many tables so how to solve this apply filter for grid.

Below is my code.

<column name="store_id" class="VendorExtensionUiComponentListingColumnStore">
        <argument name="data" xsi:type="array">
            <item name="options" xsi:type="object">MagentoCmsUiComponentListingColumnCmsOptions</item>
            <item name="config" xsi:type="array">
                <item name="filter" xsi:type="string">select</item>
                <item name="dataType" xsi:type="string">select</item>
            <item name="component" xsi:type="string">Vendor_Extension/js/ui/grid/columns/html</item>
            <item name="align" xsi:type="string">left</item>
            <item name="sortable" xsi:type="boolean">false</item>
            <item name="label" xsi:type="string" translate="true">Store View</item>
            </item>
        </argument>
    </column>