I want to display an image in the admin grid of one of my modules.
I'm using the new grid system, the one with ui components.
I took a look at how the thumbnail is added in the grid for products, but it's kind of over my head.
My entity is not EAV, is a simple flat table entity.
I tried adding this in my ui component xml file
<column name="image">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/grid/columns/image</item>
<item name="sortable" xsi:type="boolean">false</item>
<item name="altField" xsi:type="string">name</item>
<item name="has_preview" xsi:type="string">1</item>
<item name="label" xsi:type="string" translate="true">Image</item>
</item>
</argument>
</column>
but it seams to have no effect on my grid. there is no image (my db field is called image) column, no error, no nothing.
Can someone walk me through adding an image to the grid using ui components?
Best Answer
Your ui component xml should have this added:
..and then in Your\Modulename\Ui\Component\Listing\Column\Thumbnail.php something similar to this:
I hope that helps!