I have created custom column in Sales -> Order UI Grid. I have added "Profit" column. Which is not related to any database table and not the attribute. This column display just calculation of profit.

The issue is I can not sort the column. Column is sortable but it is sorting incorrectly.

I have checked many similar question in stack but nothing helpfull. As the column is not in table and not the attribute.

Following is my override file.


<?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="sales_order_columns">
        <column name="total_paid" class="Company\Module\Ui\Component\Listing\Column\PurchasedPrice">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="label" xsi:type="string" translate="true">Profit</item>
                    <item name="sortOrder" xsi:type="number">13</item>


I have faced this problem and below link helped me to get through it. Please follow the link provided below to add sorting and filtering of custom column in grid:

Custom Column Sorting in Admin Grid - Magento 2

  • Thanks but as I mentioned the column is not in any table. The data of the column is coming from on block where I calculate the profit and return the profit amount. So this link is not useful. – David Coder Aug 22 '18 at 11:38

Maybe this is already old question, but it can be helpful for someone like me facing this issue.

According to this Magento 2 GitHub issue there is a ui_bookmark table in which some settings about ui_components (and Grid in my case) are stored.

Truncating this table and clearing the cache in my case fixed the problem of columns sortOrder in Grid.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.