I have a grid with a context menu. I know how to prevent row selection on right click. I just do it in this way:

```
var allowSelection=true;
Ext.getCmp('grid').on('beforeitemmousedown', function(grid, record, item, index, event, eOpts) { 
if (event.button==0) allowSelection=true ;
else allowSelection=false;
});
Ext.getCmp('grid').on('beforeselect', function(grid, record, index, eOpts) { 
 return allowSelection;
});

```

But what I now need is to prevent row deselection. In fact, even though the current code prevents row selection, it does not prevent row deselection. 

**EDIT**

My right click event causes a context menu to pop up. The part of code, which does it, is this one

```
listeners:{
    itemcontextmenu:function(view,record,item,index,e){
      e.stopEvent();
      gridMenu.showAt(e.getXY());
    },
    containercontextmenu:function(view, e){
      e.stopEvent();
      gridMenu.showAt(e.getXY());
    }
...

```

This code is nested inside viewconfig of the grid. So, I just do not want to trigger row deselection, when my context menu pops up.

**EDIT**

Well, I did it myself. A just added `return false`:

```
if (event.button==0) allowSelection=true ;
else {
  allowSelection=false;
  return false;
}

```