Skip to content

Commit

Permalink
Add change of focus to close possible pop-up menus, trigger indirectl…
Browse files Browse the repository at this point in the history
…y 'change' event and some other advantages.

Don't process 'Enter' on "Add Group", "Add Rule", "Delete Group", "Delete Group" and "Query" buttons.

Signed-off-by: Dr. Oleg Kiriljuk <oleg.kiriljuk@ok-soft-gmbh.com>
  • Loading branch information
OlegKi committed Apr 12, 2012
1 parent d01bc10 commit 145e2ca
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions js/grid.formedit.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,16 @@ $.jgrid.extend({
}
if (p.searchOnEnter || p.closeOnEscape) {
$("#"+$.jgrid.jqID(IDs.themodal)).keydown(function (e) {
if (p.searchOnEnter && e.which === 13) { // 13 === $.ui.keyCode.ENTER
$("#"+fid+"_search").click();
var $target = $(e.target);
if (p.searchOnEnter && e.which === 13 && // 13 === $.ui.keyCode.ENTER
!$target.hasClass('add-group') && !$target.hasClass('add-rule') &&
!$target.hasClass('delete-group') && !$target.hasClass('delete-rule') &&
(!$target.hasClass("fm-button") || !$target.is("[id$=_query]"))) {
$("#"+fid+"_search").focus().click();

This comment has been minimized.

Copy link
@AlexeySmirnoff

AlexeySmirnoff Dec 23, 2013

To get a workable code with pressing Enter for the first time better split line $("#"+fid+"_search").focus().click(); on the following two:
$("#"+fid+"_search").focus();
setTimeout(function(){
$("#"+fid+"_search").click();
},0);

return false;
}
if (p.closeOnEscape && e.which === 27) { // 27 === $.ui.keyCode.ESCAPE
$("#"+$.jgrid.jqID(IDs.modalhead)).find(".ui-jqdialog-titlebar-close").click();
$("#"+$.jgrid.jqID(IDs.modalhead)).find(".ui-jqdialog-titlebar-close").focus().click();
return false;
}
});
Expand Down

0 comments on commit 145e2ca

Please sign in to comment.