【问题标题】:Magento 2 custom column sorting not workingMagento 2自定义列排序不起作用
【发布时间】:2018-08-22 10:04:49
【问题描述】:

我在Sales -> Order UI Grid 中创建了自定义列。我添加了 "Profit" 列。这与任何数据库表无关,与属性无关。此列仅显示利润的计算。

问题是我无法对列进行排序。列是可排序的,但排序不正确。

我在堆栈中检查了许多类似的问题,但没有任何帮助。由于列不在表中,不在属性中。

以下是我的覆盖文件。

sales_order_grid.xml

<?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>
                </item>
            </argument>

        </column>
    </columns>
</listing>

【问题讨论】:

  • 您找到解决方案了吗?我也面临同样的问题。
  • 没有还是没有....

标签: magento2


【解决方案1】:

也许这已经是一个老问题了,但它可能对像我这样面临这个问题的人有所帮助。

根据这个Magento 2 GitHub issue,有一个ui_bookmark 表,其中存储了一些关于UiComponents(在我的例子中是UI Grid 组件)的设置。

截断此表并在我的情况下清除缓存解决了 UI Grid 中列 sortOrder 的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多