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

The Archive Base Latest Questions

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

A friend of mine wrote some Google Closure code that contains an instance of

  • 0

A friend of mine wrote some Google Closure code that contains an instance of goog.ui.AutoComplete: http://closure-library.googlecode.com/svn/docs/class_goog_ui_AutoComplete.html

Every time this autocomplete feature makes an asynchronous request to a server, I must loop through all the rows generated by the autocomplete and do something with each of them.

Right now, I am accomplishing this as follows.

var rows = friendsAutocomplete.rows_;
for (var i = 0; i < rows.length; i++) {
  doSomething(rows[i]);
}

This works, but is very bad since I am breaking abstraction barriers by accesing the private variable friendsAutocomplete.rows_. I also cannot add new methods or properties to friendsAutocomplete since my friend adamantly refuses to do so.

How can I loop through the rows generated by the autocomplete feature without accessing private variables?

  • 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-07T12:29:02+00:00Added an answer on June 7, 2026 at 12:29 pm
    1. Create your control

      var ac = new goog.ui.AutoComplete.RichRemote(“http://blah”, inputDomElement);

    2. Create a handler for result

      So if blah Url returns a json like

      [
       ['apple',
        {name: 'Fuji', url: '..'},
        {name: 'Gala', url: '..'},
        {name: 'Golden Delicious',
         url: '..'}
       ],
       ['berry',
        {name: 'Strawberry', url: '..'},
        {name: 'Blueberry', url: '..'},
        {name: 'Blackberry',url: '..'}
       ]
      ]
      

    you need to have javascript objects in the code which are processed fo each item in the top-level array object. I guess this is what you wanted (Note: ‘apple’ , ‘berry’ match the JSON result value)

        var apple = function (item) {
        ...
        return makeRichRow_(...)
        }
    
        var berry = function (item) {
        ...
        return makeRichRow_(...)
        }
    

    and makeRichRow_ is basically where you attach a render function and select value for your item when the user selects an item. You can additionally filter the rows etc

    This is a complete demo with source code.
    http://code.google.com/p/closure-library/source/browse/trunk/closure/goog/demos/autocompleterichremote.html?r=43

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

Sidebar

Related Questions

A friend of mine has inherited an old Joomla 1.0.x site, that amongst other
A friend of mine sent me this code snippet to celebrate his new baby
A friend of mine claims that calls to Debug.Print() as well as first-chance exception
A friend of mine asked to create a static website and I found that
A friend of mine has written an irc bot, and has the code on
Hello Haskellers and Haskellettes, when reading http://learnyouahaskell.com/ a friend of mine came up with
A friend of mine wants me to convert his code into a doubly linked
A friend of mine told me that saving images in the database is not
A friend of mine wants to have some navigation-based mc links in frame 1,
a friend of mine wrote this little progam. the textFile is 1.2GB in size

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.