views:

149

answers:

1

All, Using Ext JS (3.2), how is it possible to detect whether a user is pressing/holding down a specific key whilst performing another action with a DataView component?

The specific application is to see whether the control/shift key is depressed when a right click event occurs on a DataView node, if it is, the node is selected along with any others currently selected, if not- it replaces all other selections.

Many thanks in advance for the response!

+2  A: 

You can check the event object for properties like shiftKey, ctrlKey, altKey, etc. So it would be something like this (untested):

myDataView.on('contextmenu', function(dv, idx, node, e){
    if(e.shiftKey){
        // shift is pressed
    }
});
bmoeskau
Works like a charm, many thanks!
Ergo Summary