$("#Grid").on("keydown", function (e) { var obj = $("#Grid").ejGrid("instance"), cell; var currentcell = obj.getHeaderTable().find(".e-activecell"); var field = currentcell.find("div").attr("ej-mappingname");
if (e.shiftKey) {
if (e.keyCode == 37) { //left arrow var prevcell = currentcell.prev(); if (currentcell.index("th.e-headercell") != 0) currentcell.removeClass("e-activecell") && prevcell.addClass("e-activecell"); } if (e.keyCode == 39) { //right arrow var nextcell = currentcell.next(); if (currentcell.index("th.e-headercell") != obj.getHeaderTable().find("th.e-headercell").length - 1) currentcell.removeClass("e-activecell") && nextcell.addClass("e-activecell"); } }
|
if (e.shiftKey) {
. . . if (e.keyCode == 37) { //left arrow var prevcell = currentcell.prev(); if (obj.getColumnIndexByField(field) != 0) currentcell.removeClass("e-activecell") && prevcell.addClass("e-activecell"); } if (e.keyCode == 39) { //right arrow var nextcell = currentcell.next(); if (obj.getColumnIndexByField(field) != obj.model.columns.length - 1) currentcell.removeClass("e-activecell") && nextcell.addClass("e-activecell"); } } if (e.keyCode == 9) { var nextcell = currentcell.next(); if (obj.getColumnIndexByField(field) != obj.model.columns.length - 1) currentcell.removeClass("e-activecell") && nextcell.addClass("e-activecell"); if (currentcell.length > 0) e.preventDefault(); } |