Rendering a html tag in Grid Magento 2

After a a while of digging to magento core code, i firgured that out.

Add this line to column declaration:

<item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>

like so:

 <column name="shipping_number" class="Eyemagine\Frogfish\Ui\Component\Listing\Column\ShippingNumber">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
                <item name="filter" xsi:type="string">text</item>
                <item name="sortOrder" xsi:type="number">100</item>
                <item name="label" xsi:type="string" translate="true">Shipping Number</item>
            </item>
        </argument>
    </column>

You could also write:

<column name="shipping_number" class="Eyemagine\Frogfish\Ui\Component\Listing\Column\ShippingNumber"
            sortOrder="40">
   <settings>
      <filter>text</filter>
      <bodyTmpl>ui/grid/cells/html</bodyTmpl>
      <label translate="true">Shipping Number</label>
   </settings>
</column>

Tags:

Grid

Magento2