Skip to content

Magento 2: How to change “Actions” column position in UI Component?

I have a problem with my ui components in admin.

The Actions always is after “Enabled” column :/
This column should be last. How to change it position?
I tired to add attribute sortOrder="XX" to all columns like this <column name="..." sortOrder="...">, but doesn’t work.
Yes, I cleaned cache, comment all columns, reload adminhtml page and uncomment columns and reload page again. Actions is still after Enabled column.

My file:
vendor/{vendor}/{module}/view/adminhtml/ui_component/{vendor}_{module}_example_listing.xml:

<?xml version="1.0" ?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <argument name="data" xsi:type="array">
        <item name="js_config" xsi:type="array">
            <item name="provider" xsi:type="string">vendor_module_example_listing.vendor_module_example_listing_data_source</item>
        </item>
    </argument>
    <settings>
        <spinner>vendor_module_example_columns</spinner>
        <deps>
            <dep>vendor_module_example_listing.vendor_module_example_listing_data_source</dep>
        </deps>
        <buttons>
            <button name="add">
                <url path="*/*/new"/>
                <class>primary</class>
                <label translate="true">Add new example</label>
            </button>
        </buttons>
    </settings>
    <dataSource name="vendor_module_example_listing_data_source" component="Magento_Ui/js/grid/provider">
        <settings>
            <storageConfig>
                <param name="indexField" xsi:type="string">example_id</param>
            </storageConfig>
            <updateUrl path="mui/index/render"/>
        </settings>
        <aclResource>Vendor_Module::example</aclResource>
        <dataProvider name="vendor_module_example_listing_data_source" class="MagentoFrameworkViewElementUiComponentDataProviderDataProvider">
            <settings>
                <requestFieldName>id</requestFieldName>
                <primaryFieldName>example_id</primaryFieldName>
            </settings>
        </dataProvider>
    </dataSource>
    <listingToolbar name="listing_top">
        <settings>
            <sticky>true</sticky>
        </settings>
        <bookmark name="bookmarks"/>
        <columnsControls name="columns_controls"/>
        <filters name="listing_filters"/>
        <paging name="listing_paging"/>
    </listingToolbar>
    <columns name="vendor_module_example_columns">
        <settings>
            <editorConfig>
                <param name="selectProvider" xsi:type="string">vendor_module_example_listing.vendor_module_example_listing.vendor_module_example_columns.ids</param>
                <param name="enabled" xsi:type="boolean">true</param>
                <param name="indexField" xsi:type="string">example_id</param>
                <param name="clientConfig" xsi:type="array">
                    <item name="saveUrl" xsi:type="url" path="vendor_module/example/inlineEdit"/>
                    <item name="validateBeforeSave" xsi:type="boolean">false</item>
                </param>
            </editorConfig>
            <childDefaults>
                <param name="fieldAction" xsi:type="array">
                    <item name="provider" xsi:type="string">vendor_module_example_listing.vendor_module_example_listing.vendor_module_example_columns_editor</item>
                    <item name="target" xsi:type="string">startEdit</item>
                    <item name="params" xsi:type="array">
                        <item name="0" xsi:type="string">${ $.$data.rowIndex }</item>
                        <item name="1" xsi:type="boolean">true</item>
                    </item>
                </param>
            </childDefaults>
        </settings>
        <selectionsColumn name="ids">
            <settings>
                <indexField>example_id</indexField>
            </settings>
        </selectionsColumn>
        <column name="example_id" sortOrder="10">
            <settings>
                <filter>text</filter>
                <sorting>asc</sorting>
                <label translate="true">ID</label>
            </settings>
        </column>
        <column name="is_enabled" sortOrder="20">
            <settings>
                <filter>text</filter>
                <label translate="true">Enabled</label>
                <editor>
                    <editorType>text</editorType>
                    <validation>
                        <rule name="required-entry" xsi:type="boolean">false</rule>
                    </validation>
                </editor>
            </settings>
        </column>
        <column name="column_a" sortOrder="30">
            <settings>
                <filter>text</filter>
                <label translate="true">column_a</label>
                <editor>
                    <editorType>text</editorType>
                    <validation>
                        <rule name="required-entry" xsi:type="boolean">false</rule>
                    </validation>
                </editor>
            </settings>
        </column>
        <column name="column_b" sortOrder="40">
            <settings>
                <filter>text</filter>
                <label translate="true">column_b</label>
                <editor>
                    <editorType>text</editorType>
                    <validation>
                        <rule name="required-entry" xsi:type="boolean">false</rule>
                    </validation>
                </editor>
            </settings>
        </column>
        <column name="column_c" sortOrder="50">
            <settings>
                <filter>text</filter>
                <label translate="true">column_c</label>
                <editor>
                    <editorType>text</editorType>
                    <validation>
                        <rule name="required-entry" xsi:type="boolean">false</rule>
                    </validation>
                </editor>
            </settings>
        </column>
        <column name="column_d" sortOrder="60">
            <settings>
                <filter>text</filter>
                <label translate="true">column_d</label>
                <editor>
                    <editorType>text</editorType>
                    <validation>
                        <rule name="required-entry" xsi:type="boolean">false</rule>
                    </validation>
                </editor>
            </settings>
        </column>
        <column name="column_e" sortOrder="70">
            <settings>
                <filter>text</filter>
                <label translate="true">column_e</label>
                <editor>
                    <editorType>text</editorType>
                    <validation>
                        <rule name="required-entry" xsi:type="boolean">false</rule>
                    </validation>
                </editor>
            </settings>
        </column>
        <actionsColumn name="actions" class="VendorModuleUiComponentListingColumnExampleActions" sortOrder="200">
            <settings>
                <indexField>example_id</indexField>
                <resizeEnabled>false</resizeEnabled>
                <resizeDefaultWidth>107</resizeDefaultWidth>
            </settings>
        </actionsColumn>
    </columns>
</listing>

Actuall result

enter image description here

Dropdown opened:
enter image description here