0

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;
        }
    }
},
MarthyM
  • 1,839
  • 2
  • 21
  • 23
T1000
  • 2,909
  • 7
  • 36
  • 53
  • Are u sure u want this? It's quite complicated task to actually remove column from the grid. Why don't you simply hide it using standard feature? – sha May 07 '12 at 22:38
  • Maybe... but it is still interesting task - my idea was to add something like custom trigger in the header ([X] button) – T1000 May 08 '12 at 06:40

1 Answers1

2

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).

gunnx
  • 1,229
  • 7
  • 16