Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8220549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:33:29+00:00 2026-06-07T13:33:29+00:00

jQgrid form contains several jQueryUI autocomplete boxes. In keydown event handler Esc key press

  • 0

jQgrid form contains several jQueryUI autocomplete boxes.

In keydown event handler Esc key press needs to be processed only if autocomplete dropdown box is not open. If autocomplete dropdown is open, Esc press shoult perform its default action only (closing dropdown and cancelling selection).

How to check if autocomplete dropdown was opened ?
It can check for any autocomplete box was opened in document body.

jQuery.extend(jQuery.jgrid.edit, {
   beforeShowForm: function ($form) {
            var gridIdEncoded = $.jgrid.jqID($form[0].id.substring(8));
            $("#editmod" + gridIdEncoded).bind('keydown.formEvent', function (e) {
                 if (e.which === 27) {
                   // Todo: How invoke click only if any autocomplete dropdown is not opened
                   $("#TblGrid_" + gridIdEncoded + "_2 #cData").trigger("click");
                   return false;
                   }
               });
         }
     });

Update

I tried Dr. Molle answer using

 if (e.which === 27) {  
   alert( $('.ui-autocomplete.ui-widget:visible').length );
   if ( $('.ui-autocomplete.ui-widget:visible').length != 0 )
     // dropdown is open, allow default behaviour
     return;

but $(‘.ui-autocomplete.ui-widget:visible’).length is 0 if esc is pressed (it is 1 if other key is pressed and dropdown is open).
It looks like causing Esc causes causes autocomplete default behaviour first wthis closes dropdown.
Only after this my handler is executud which does not find that dropdown is executed.

How fix this ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T13:33:31+00:00Added an answer on June 7, 2026 at 1:33 pm

    Andru’s comment is right on. If you cancel propegation of the event after the autocomplete closes, it squelches the ESC

    $('.autocomplete').bind('autocompleteclose', function(event, ui) {
    return false;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

jqGrid add forms contains autocomplete boxes using code below. If new row is added
Page contains single form with input elements and jqgrid data. jqGrid data is retrieved
i'm trying to use jQuery multiselect plugin in a form editing jqGrid (add form).
After long searches, I succeed to delete a row in a jqgrid with form
Here is code my jqgrid editing through form. $(#DataEnergy).jqGrid('navGrid', '#pagergrid', {}, //options {editdata: {
I am trying to use jqGrid within a form where the user fills out
Is possible to have additional fields in jqgrid form? Say perhaps additional datepicker or
I have a jqGrid that has add/edit dialogs with a form that's longer than
I'm trying to use form editing on jqgrid. When the data is sent to
I'm trying to use form editing on jqgrid. When the data is changed, data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.