TransWikia.com

Magento 2 add product created at date to filter product in admin grid

Magento Asked by Vikas kalal on March 1, 2021

I want to filter products by date in the admin product grid. Is there any help will be appreciated.

2 Answers

For Magento 2, I've matched the configuration of other columns, and ended up with this (which works for me):

<column name="created_at" component="Magento_Ui/js/grid/columns/date" sortOrder="110">
    <settings>
        <addField>true</addField>
        <filter>dateRange</filter>
        <dataType>date</dataType>
        <label translate="true">Created At</label>
    </settings>
</column>

Answered by GGrec on March 1, 2021

I Have achieved it by this trick.If any other would-be appreciatable.

We can add the below code on this file :

/MagentoRoot/vendor/magento/module-catalog/view/adminhtml/ui_component/product_listing.xml

<column name="created_at">
   <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="filter" xsi:type="string">dateRange</item>
            <item name="editor" xsi:type="string">text</item>
            <item name="label" xsi:type="string" translate="true">Created At</item>
            <item name="sortOrder" xsi:type="number">60</item>
        </item>
    </argument>
</column>

enter image description here

Filtered Results

enter image description here

Answered by Vikas kalal on March 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP