0

How to add the custom class or ID on Magento 2 Product Admin Grid Columns basically I want to add a class or id on ( qty, price, name, SKU ) on these fields.

Any help is appreciated.

1 Answer 1

0

Need to create a custom module and add this.

File Path : app/code/Vendor/Module/view/adminhtml/ui_component/product_listing.xml

Argument part also disabled the link on rows i need that so posted here if anyone needed that.

<?xml version="1.0" encoding="utf-8"?> 
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> 
<columns name="product_columns">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="childDefaults" xsi:type="array">
                <item name="fieldAction" xsi:type="array">
                    <item name="provider" xsi:type="string">product_listing.product_listing.product_columns_editor</item>
                    <item name="target" xsi:type="string">startEdit</item>
                    <item name="params" xsi:type="array">
                        <item name="0" xsi:type="string">${ $.$data.rowIndex }</item>
                        <item name="1" xsi:type="boolean">true</item>
                    </item>
                </item>
            </item>
        </item>
    </argument>
    <column name="entity_id">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="fieldClass" xsi:type="string">tnbl_product_id</item>
            </item>
        </argument>
    </column>
    <column name="name">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="fieldClass" xsi:type="string">tnbl_product_name</item>
            </item>
        </argument>
    </column>
    <column name="sku">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="fieldClass" xsi:type="string">tnbl_product_sku</item>
            </item>
        </argument>
    </column>
    <column name="qty">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="fieldClass" xsi:type="string">tnbl_product_qty</item>
            </item>
        </argument>
    </column>
    <column name="price">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="fieldClass" xsi:type="string">tnbl_product_price</item>
            </item>
        </argument>
    </column>
</columns> 

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.