Closed
Description
I am trying to add a new column to item grid in admin sales/order/view .
The problem is that in the layout the default renderer does not have a name attribute, only the as attribute, thus not allowing to add new column content. Even though I can add new column headers to the layout, using <referenceBlock name="order_items">
directive, I cannot add the column's content using the same aproach.
Preconditions
- Magento 2.1.x
Steps to reproduce
- Create sales_order_view.xml in custom module's adminhtml layouts folder
- Add a column in order_items arguments:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="order_items">
<arguments>
<argument name="columns" xsi:type="array">
<item name="test_column" xsi:type="string" translate="true">Test Header</item>
</argument>
</arguments>
<block class="Namespace\Vendor\Block\Adminhtml\Order\Items\Column\TestColumn" name="column_production_id" template="Namespace_Vendor::order/items/column/test_column.phtml" group="column" />
</referenceBlock>
</body>
</page>
Expected result
- Column content should be displayed according to test_column.phtml
Actual result
- Only column headers are added
There should be posibility to add cell renderer using <referenceBlock name="default">
directive, like column addition.
The only solution I find is adding an afterGetColumns plugin to Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer, solutions which does not seem so elegant to me.
Metadata
Metadata
Assignees
Labels
The issue has been fixed in 2.2 release lineGate 2 Passed. Manual verification of the issue description passedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 1 Passed. Automatic verification of issue format passedGate 4. Acknowledged. Issue is added to backlog and ready for development