|
$("#Grid").ejGrid({
...
allowKeyboardNavigation: true,
...
}) |
|
<script type="text/javascript">
var argsval;
$(function () {
$("#Grid").ejGrid({
...
allowKeyboardNavigation: true,
create: function (args) {
argsval = args;
$(document).on("keydown", function (e) { //keydown event
if (e.shiftKey && e.keyCode === 38) { // Shift + up arrow- key code.
$("#Grid").find(".e-gridcontent .e-row .e-active").focus(); //focus grid
var curEl;
var gridObj = $("#Grid").ejGrid("instance");
if (gridObj.selectedRowsIndexes[0] != -1) {
...
gridObj.expandCollapse(curEl);
}
else {
curEl = currentTr.find(".e-detailrowexpand");
gridObj.expandCollapse(curEl);
}
}
}
if (e.shiftKey && e.keyCode === 40) { //shift + down arrow key.
$("#Grid").find(".e-gridcontent .e-row .e-active").focus(); //focus grid
var curEl ;
var gridObj = $("#Grid").ejGrid("instance");
if (gridObj.selectedRowsIndexes[0] != -1) {
...
gridObj.expandCollapse(curEl);
}
else {
curEl = currentTr.find(".e-detailrowexpand");
gridObj.expandCollapse(curEl);
}
}
}
});
},
columns: [...
childGrid: {
dataSource: [{ ID: "test", Something: "other" }],
...
}
})
});
$("#collapsebutton").ejButton({ click: "btnClick" });
function btnClick() {
var curEl ;
...
}
}
</script> |
Hello,
Thank you for your response. That has corrected the initial however, we now have an issue when on keyboard navigation pressing enter clears the focus from the grid entirely. Is this expected behaviour? Is there a workaround for this so we do not lose focus?
We can replicate in your provided link:
|
<script>
$("#Grid").ejGrid({
keySettings: {
saveRequest: ""
},
});
</script> |
Unfortunately, that solution will not work for us.
The grid we are using does have the add/edit functionality, however, I am talking about the enter key when the grid is not in edit mode, the focus is completely removed from the grid. When in add/edit mode the enter key works as intended.
Please see the issue in the following demo: http://jsplayground.syncfusion.com/agboqdpu