Search code examples
extjscontextmenugridpanelright-click

gridpanel right click to delete column


I'm trying to make functionality for deleting column from grid, but I have problem with detecting on which column user right clicked (right click > context menu with delete option).

For the moment I'm displaying the contextMenu something like that

viewConfig: {
    stripeRows: true,
    listeners: {
        itemcontextmenu: function(view, rec, node, index, e) {
            e.stopEvent();
            contextMenu.showAt(e.getXY());
            return false;
        }
    }
},

Solution

  • You could attach the handler to the contextmenu event for every column, that would give you access to the Column. Then you could refresh the columnmodel by using the setConfig function passing in the new array of columns (minus the one you just deleted).