Answer in how to enable enter in jqgrid advanced search window describes how to enable enter and other keys in jqgrid advanced search dialog.
After clicking Add group, Add subgrup, Delete rule or Delete group button in advanced search dialog Enter and other keys are still ignored. How set focus to added element or after delete remaining element to enable Enter and other keys?
The current version of the Advanced Searching dialog (see definition of
jqFilterin thegrid.filter.js) recreate all controls of the dialog on change of someone. See the code of reDraw which looksHow one can see the first line
$("table.group:first",this).remove();delete the content of all filter. The current focus will be lost and one have the problems which you described.I suggest to fix the code of
reDrawusing document.activeElement element which was introduced in Internet Explorer originally (at least in IE4) and which is supported now in all web browsers because it’s part of HTML5 standard (see here). The element which has focus originally will be destroyed and one will unable to set focus on it later. So I suggest to save the element name of the element and it’s classes (likeinput.add-grouporinput.add-rule.ui-add) and to find the position of the element on the searching dialog. Later, after the dialog element will be recreated we’ll set focus on the element with the same index.I suggest to change the code of
reDrawto the followingLike one can see on the next demo the focus in the Searching Dialog stay unchanged after pressing on the “Add subgroup” or “Add rule” buttons. I set it on the “Add rule” buttons of the previous row group in case of pressing “Delete group”.
One more demo use jQuery UI style of the buttons and the texts in the buttons (see the answer). After clicking on the “Delete” (rule or group) button I tried to set the focus to the previous “Add Rule” button because setting of the focus on another “Delete” (rule or group) button I find dangerous.
Additionally in the demo I use
because it seems me meaningful to set initial focus on the last input field at the dialog opening.
UPDATED: I find additionally meaningful to set focus on the current clicked buttons “Add subgroup”, “Add rule” or “Delete group”. The advantage one sees in the case it one first click some button with the mouse and then want to continue the work with keyboard. So I suggest to change the line
to
To change the line
to
and the line
to
and the line
to