<script type="text/javascript"> $(function () { $("#Grid").ejGrid({ . . . . keySettings: { firstRowSelection: "9, ctrl+36" }, //9- tab key, 36 – home key //by assigning multiple key values for a property in key settings, we can achieve multiple key support for a single operation }); </script> |
<script type="text/javascript"> $(function () { var index = 0; $("#Grid").focusin(function (e) { //focusin event of the grid index = index == -1 ? 0 : index; $("#Grid").ejGrid('selectRows', index); //select the row }) $("#Grid").ejGrid({ . . . . dataBound: function () { this.element.focusout(function () { //focus out event of the grid index = $("#Grid").ejGrid('model.selectedRowIndex'); //save the selectedRowIndex in a variable $("#Grid").ejGrid('clearSelection'); //perform clear selection }) },
});
});
|
$(function () { var index = 0,isClick; //Binding click event to the grid $("#Grid").bind('click', function () { isClick = true; }) //Binding keyup event to the grid .bind('keyup', function (e) { if (e.which == 9) { isClick = false; } }); var focusHandler = function () { //prevent the record selection if the row selected through mouse clicked if (!isClick) { index = index == -1 ? 0 : index; $("#Grid").ejGrid('selectRows', index); } } $("#Grid").on("focusin", function (e) { //Timeout for triggering click and keyup events setTimeout(focusHandler, 200); });
});
|
dataBound: function () { this.element.focusout(function () { index = $("#Grid").ejGrid('model.selectedRowIndex'); $("#Grid").ejGrid('clearSelection'); $("div.e-gridtoolbar").removeAttr("tabindex"); } ) |
var focusHandler = function () { if (document.activeElement.id == "Grid_toolbarItems") flag = 1; else flag = 0; if (!isClick && flag == 0) { index = index == -1 ? 0 : index; $("#Grid").ejGrid('selectRows', index); }
|