0

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="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider">
            <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="Vendor\Module\Ui\Component\Listing\Column\ExampleActions" 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

1 Answer 1

1

did u try deleting rows in the table = "ui_bookmark" , in this table in the column = "namespace" you should find your listing ui component file and delete that row and try again with just refreshing the page , maybe it should work ,

This table is useful in saving all the settings of the grid in the admin side, have u ever wondered you may change a column view other than default and when logging out and loggin in again how it remains same just like you left ? Well , this table is the reason as this stores this type of grid settings.

if not please reply so that i can try finding other solutions for you , if this post helped please do give a like as this helps me answer more. Thanks.

enter image description here

1
  • Thank you very much for your reply! I did not know that such things are stored in the database. I went through all the files in my module twice and tried different combinations…
    – GieDe
    Commented Oct 5, 2022 at 18:46

Your Answer

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

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