Results 1 to 3 of 3

Thread: Grid keyboard shortcuts bindings involving Left/Right arrow

  1. #1
    Sencha Premium Member
    Join Date
    Jul 2015
    Posts
    25

    Default Grid keyboard shortcuts bindings involving Left/Right arrow

    Hi,
    I'm trying to assign a shortcut to the Indent / Outdent methods using the Arrow keys combined with Alt & Shift keys.
    This is my code:


    Code:
     new Ext.util.KeyMap({
        target:window,
        binding:[
          {
            key:45,
            fn:function (e) {
    
    
              if (MSP.Util.GanttTable.isEnableKeyShortcuts()) {
    
    
                MSP.Util.GanttTable.getController().onAddTask();
    
    
              }
    
    
            },
            stopEvent:true
          },
          {
            key:46,
            fn:function (e) {
    
    
              if (MSP.Util.GanttTable.isEnableKeyShortcuts()) {
    
    
                MSP.Util.GanttTable.getController().onRemoveSelectedTasks();
    
    
              }
    
    
            },
            stopEvent:true
          },
          {
            key:39,
            alt:true,
            shift:true,
            fn:function (e) {
    
    
              if (!MSP.Util.GanttTable.isReadOnly()) {
    
    
                MSP.Util.GanttTable.getController().onIndent();
    
    
              }
    
    
            },
            stopEvent:true
          },
          {
            key:37,
            alt:true,
            shift:true,
            fn:function (e) {
    
    
              if (!MSP.Util.GanttTable.isReadOnly()) {
    
    
                MSP.Util.GanttTable.getController().onOutdent();
    
    
              }
    
    
            },
            stopEvent:true
          }
        ]
      });
    here is a fiddle:
    https://fiddle.sencha.com/#fiddle/sdi

    The top two bindings works as expected but the bindings involving the arrow keys are ignored unless I'm in an edit mode of a specific cell in that row (meaning i've clicked on Name cell for example and in typing mode).
    I think it has something to do with the fact that the arrow keys are used to navigate between the cells.(even though I assigned them with Shift+Alt).


    Thanks!

  2. #2
    Sencha User joel.watson's Avatar
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446

    Default

    Yes, the grid's navigation model has it's own key nav implemented, so those will win in terms of specificity.

    You should be able to listen to the "beforeitemkeydown" event of the grid and veto the events if you'd like, and then implement whatever processing you'd like.

    Thanks!
    Joel

  3. #3
    Sencha Premium Member
    Join Date
    Jul 2015
    Posts
    25

    Default

    Thanks... that worked.Though I'd expect a more elegant solution.Maybe just not overriding KeyMap bidings ?

Similar Threads

  1. keyboard shortcuts in 1.0 ...
    By jayj in forum Ext GWT: Help & Discussion (1.x)
    Replies: 4
    Last Post: 7 Jul 2009, 12:56 PM
  2. Keyboard Bindings
    By [email protected] in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 24 Feb 2008, 9:37 AM
  3. using keyboard (arrow up/ down) in grid with FF?
    By franklt69 in forum Ext 1.x: Help & Discussion
    Replies: 15
    Last Post: 6 Feb 2007, 6:00 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •