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 6917843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:46:53+00:00 2026-05-27T09:46:53+00:00

If context menu is added to jqGrid using Custom values to Context Menu Items

  • 0

If context menu is added to jqGrid using Custom values to Context Menu Items in JQgrid and text filed inline editing is used, textbox standard context menu is not available, it is replace with jqGrid context menu.

How to add standard textbox context menu commands ( Undo, Cut, Copy, Paste, Delete, Select all ) to jqGrid conext menu or how to show standard context menu for textbox inline editing?

Update

On inline edit, if standard menu is opened by right clicking on yellow background or in autocomplete box and after that standard browser context menu is opened, custom menu is not closed, two menus appear.

two menus

How to 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-05-27T09:46:54+00:00Added an answer on May 27, 2026 at 9:46 am

    It’s not easy to implement in context menu commands like “Copy”, “Paste”, … so I decide to modify my demo from the answer on your previous question. In the new demo the context menu appears only if the page contains no selected text.

    The first problem is that the original code of the jquery.contextmenu.js contains the following code fragment:

    $(this).bind('contextmenu', function(e) {
      // Check if onContextMenu() defined
      var bShowContext = (!!hash[index].onContextMenu) ? hash[index].onContextMenu(e) : true;
      if (bShowContext) display(index, this, e, options);
      return false;
    });
    

    So the contextmenu handler return always false and prevent creating of the standard context menu. I fix the code to the following (you can download full modified code here):

    $(this).bind('contextmenu', function(e) {
      // Check if onContextMenu() defined
      var bShowContext = (!!hash[index].onContextMenu) ? hash[index].onContextMenu(e) : true;
      currentTarget = e.target;
      if (bShowContext) {
        display(index, this, e, options);
        return false;
      }
    });
    

    The code of createContexMenuFromNavigatorButtons functions described here I modified

    onContextMenu: function (e) {
        var rowId = $(e.target).closest("tr.jqgrow").attr("id"), p = grid[0].p, i,
            lastSelId;
    
        if (rowId && getSelectedText() === '') {
            ...
            return true;
        } else {
            return false; // no contex menu
        }
    }
    

    to use getSelectedText() and to create the context menu only if no text is selected. As the result you will be see your custom context menu only if no text is selected and see the standard context menu (which depend on web browser) if the text selection exist:

    enter image description here

    UPDATED: I modified my bug report about jquery.contextmenu.js with additional information based on the answer. I hope that the changes will be soon in the main code of jquery.contextmenu.js included in the plugins subdirectory.

    UPDATED 2: How you can see here all the fixes are already in the main code of jqGrid on the github and in included in the jqGrid 4.3.

    UPDATED 3: If you want to have the standard context menu for all enabled <input type="text" ...>, <input type="textarea" ...> and <textarea ...> elements you should just modify a little the code inside of onContextMenu callback. For example

    onContextMenu: function (e) {
        var p = grid[0].p, i, lastSelId,
            $target = $(e.target),
            rowId = $target.closest("tr.jqgrow").attr("id"),
            isInput = $target.is(':text:enabled') ||
            $target.is('input[type=textarea]:enabled') ||
            $target.is('textarea:enabled');
        if (rowId && !isInput && getSelectedText() === '') {
            ...
    

    see one more demo where inline editing will be activate by double-click.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I added a custom menu to the menu button using the following code: @Override
I created a context menu using CreatePopupMenu(). I then added menu entries using InsertMenu(..),
i have added an item in the context menu of windows explorer using registry.
I developed a VS 2008 add-in and added a custom menu item to context
So I recently added a context menu to the events in my FullCalendar using
I am using Internet Explorer. I added a context menu item (through the registry)
I have added context menu to my google map like this: map.addControl(new ContextMenuControl()); it
How do I show or hide context menu items based on condition (For example,
How can I add menu items to the Context menu for folders? I don't
I'm trying the jQuery Context Menu with jQuery Draggable rows in a jQGrid .

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.