angular ui grid - Prevent Keypress-events ( f.e. enter-key) -
i'm looking stop keyboard events ui-grid . example: ui-grid navigates next row pressing enter-key, here need prevent action. using celltemplate implements ng-keypress-listener, can't stop ui-grid switch next row hitting enter-key.
does know how prevent ui-grid or switch off keyboards events?
you can adjust default functionality overwriting services/directives.
i created plunkr case.
copy whole service containing keylistener cellnavigation , remove enter
-watcher.
getdirection: function (evt) { if (evt.keycode === uigridconstants.keymap.left || (evt.keycode === uigridconstants.keymap.tab && evt.shiftkey)) { return uigridcellnavconstants.direction.left; } if (evt.keycode === uigridconstants.keymap.right || evt.keycode === uigridconstants.keymap.tab) { return uigridcellnavconstants.direction.right; } /* if (evt.keycode === uigridconstants.keymap.up || (evt.keycode === uigridconstants.keymap.enter && evt.shiftkey) ) { return uigridcellnavconstants.direction.up; } */ if (evt.keycode === uigridconstants.keymap.pg_up){ return uigridcellnavconstants.direction.pg_up; } /* if (evt.keycode === uigridconstants.keymap.down || evt.keycode === uigridconstants.keymap.enter && !(evt.ctrlkey || evt.altkey)) { return uigridcellnavconstants.direction.down; } */ if (evt.keycode === uigridconstants.keymap.pg_down){ return uigridcellnavconstants.direction.pg_down; } return null; },
the direction.up
, direction.down
checks commented out else works expected. appended service @ bottom of plunkr app.js.
Comments
Post a Comment