Total Pageviews

23 Apr 2015

Override Keyboard Keys in SharePoint

Here is a simple way to override keyboard keys in SharePoint:

 overrideKeys = function () {  
 /*This is a standard SharePoint Function, that listens to keyboard events*/  
   window.OnListViewKeyDown = function OnListViewKeyDown(a, b) {  
     var d = GetListContextFromContextNumber(String(b));  
     if (d == null || d.inGridMode) return;  
     var e = a.keyCode,  
       c = a.shiftKey || a.ctrlKey;  
     if (IsCallOutOn()) return;  
     switch (e) {  
       case Sys.UI.Key.del:  
         //Oveeride Delete Button  
       case Sys.UI.Key.up:  
         SelectNextRow(b, -1, c, a);  
       case Sys.UI.Key.down:  
         SelectNextRow(b, 1, c, a);  
       case Sys.UI.Key.enter:  
         if (IsEventTargetAnchor(a)) return;  
         if ( != null && !IsStrNullOrEmpty( &&"ms-lstItmLinkAnchor") >= 0) OpenCallOutOrECB(b, a);  
         else ListItem_Open(b, a)  
           case Sys.UI.Key.esc:  
                 //override Esc  
 $(function () {  
   setTimeout(overrideKeys, 600);  
You can have a look at the full list of Sys.UI.Keys here

No comments:

Post a Comment