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

  • Home
  • SEARCH
  • 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 9012271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:57:11+00:00 2026-06-16T02:57:11+00:00

I’m having trouble implementing autocomplete in jqgrid. I’ve walked researching, alias until I based

  • 0

I’m having trouble implementing autocomplete in jqgrid. I’ve walked researching, alias until I based this question on a site that currently do not meet. The problem is this, I have to use the autocomplete several times throughout the application I’m developing. And now I have this function:

Javascript:

function autocomplete_element(value, options) {
    var $ac = $('<input type="text"/>');
    $ac.val(value);
    $ac.autocomplete({
    source: function(request, response) 
    {        
        $.getJSON("autocomplete.php?id=estrategico",
            { q: request.term }, response);
    }
    });
    return $ac;
}

Jqgrid:

jQuery("#obj_oper_org").jqGrid({
    (...)
        {name:'COD_OBJ_EST',index:'COD_OBJ_EST', hidden: true, editable:true, editrules:{required:true, edithidden:true}, edittype : 'custom', editoptions : {'custom_element' : autocomplete_element}},

What was intended to pass a parameter to the javascript function more in order not to repeat forever the same function for each field because I need to be constantly changing url. Is it possible to make something of the genre? Sorry for the question but I do not have much experience in javascript, so I have some difficulties

  • 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-16T02:57:12+00:00Added an answer on June 16, 2026 at 2:57 am

    First of all you don’t need to use edittype : 'custom' to be able to use jQuery UI Autocomplete. Instead of that you can use just dataInit.

    You can define myAutocomplete function for example like

    function myAutocomplete(elem, url) {
        setTimeout(function () {
            $(elem).autocomplete({
                source: url,
                minLength: 2,
                select: function (event, ui) {
                    $(elem).val(ui.item.value);
                    $(elem).trigger('change');
                }
            });
        }, 50);
    }
    

    and then use

    { name:'COD_OBJ_EST', hidden: true, editable: true,
        editoptions: {
            dataInit: function (elem) {
                myAutocomplete(elem, "autocomplete.php?id=estrategico");
            }
        }}
    

    Be careful that the name of parameter which will be send to the server is the standard name term instead of the name q which you currently use. I personally don’t see any need to change the default name of the parameter.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

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.