Rearrange the Action column of the Magento2 grid?

ActionsColumn in the Magento2 UI component has a configuration option called, “draggable” and It’s defaulted value is 0.

If you want the Action column to active drag and drop you need to activate this to true.

Let’s check with the code sample in magento2.

Create requirejs-config.js file in the following path

app/code/MageChallenge/SetupData/view/adminhtml/requirejs-config.js

var config = {
    map: {
        '*': {
            'Magento_Ui/js/grid/columns/actions': 'MageChallenge_SetupData/js/actions',
            uiGridColumnsActions: 'Magento_Ui/js/grid/columns/actions'
        }
    }
};

Then create actions.js custom file under app/code/MageChallenge/SetupData/view/adminhtml/web/js/ and set draggable to true.

Here going to make it draggable on the customer listing page only. If you want to add it to everywhere you can remove this “customer-index-index” class.

define([
    "jquery",
    'uiGridColumnsActions'
], function($, actions){
    'use strict';

    if($( 'body' ).hasClass( 'customer-index-index' )){
        return actions.extend({
            defaults: {
                draggable: true
            }
        });
    }else{
        return actions;
    }
});

Okay. The

  • delete the customer_listing in ui_bookmark table
  • Run rm -rf var/cache/ var/view_preprocessed/ pub/static/adminhtml/
  • php bin/magento setup:static:content:deploy

Now all finish.

Rearrange the Action column of the Magento2 grid
Rearrange the Action column of the Magento2 grid

Thank you ­čÖé

Latest posts by Chathura Janaka Liyanage (see all)

6 thoughts on “Rearrange the Action column of the Magento2 grid?

  1. I’m just commenting to let you be aware of of the excellent discovery my cousin’s child enjoyed going through your blog. She discovered a wide variety of details, most notably how it is like to have a very effective coaching heart to get a number of people clearly completely grasp a number of advanced issues. You actually did more than her desires. I appreciate you for churning out such effective, dependable, edifying and cool guidance on that topic to Emily.

  2. I am also writing to make you know what a incredible encounter my friend’s girl gained reading through your web page. She learned plenty of pieces, which include what it’s like to possess an amazing helping mood to let other folks smoothly know just exactly several multifaceted subject matter. You truly exceeded our own expectations. Thank you for offering these necessary, safe, explanatory and even fun tips about this topic to Julie.

Leave a Reply