2

I try to put a hardcore column 'status' in to my product grid list.

Here is my column tag.

<column name="custom" class="AIS\Custom\Ui\Component\Listing\Column\Seller\Course\Status">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">text</item>
                    <item name="add_field" xsi:type="boolean">true</item>
                    <item name="label" xsi:type="string" translate="true">Status</item>
                    <item name="sortOrder" xsi:type="number">40</item>
                    <item name="resizeEnabled" xsi:type="boolean">true</item>
                    <item name="resizeDefaultWidth" xsi:type="string">250</item>
                    <item name="indexField" xsi:type="string">entity_id</item>
                </item>
            </argument>
        </column>

And my column class

class Status extends \Magento\Ui\Component\Listing\Columns\Column
{   
    public function prepareDataSource(array $dataSource)
    {
        if (isset($dataSource["data"]["items"])) {
            foreach ($dataSource["data"]["items"] as & $item) {
                $name = $this->getData("name");
                $item[$name] = "Completed";
            }
        }
        return $dataSource;
    }
}

It is success to show "Completed" in my grid component. However, sort the column or filter by column is not work for the column. Do I missing something need to modify ?

1
  • Hey! Any news on this? Did you manage to solve it anyhow? Mar 6, 2019 at 15:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.