Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Autocompleter remote call?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
m.curtis  
View profile  
 More options Apr 7 2011, 12:59 am
From: "m.curtis" <m.cur...@me.com>
Date: Wed, 6 Apr 2011 21:59:28 -0700 (PDT)
Local: Thurs, Apr 7 2011 12:59 am
Subject: Autocompleter remote call?
I've got the autocompleter working based off the code in the
functional tests for a stored javascript response. Does anyone have
any example code for hooking it up to a remote JSON request?

I saw in the docs that findChoices will refresh the autocomplete, but
it seems like there should be a remote option for the autocompleter
itself?

Thanks!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
m.curtis  
View profile  
 More options Apr 7 2011, 3:05 pm
From: "m.curtis" <m.cur...@me.com>
Date: Thu, 7 Apr 2011 12:05:11 -0700 (PDT)
Local: Thurs, Apr 7 2011 3:05 pm
Subject: Re: Autocompleter remote call?
I ended up patching autocompleter to accomplish this for the time
being, if anybody has a different/better way of accomplishing this,
please let me know.

https://github.com/mcurtis/scripty2

On Apr 6, 9:59 pm, "m.curtis" <m.cur...@me.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tom Gregory  
View profile  
 More options Jul 10 2011, 10:12 pm
From: Tom Gregory <tagreg...@gmail.com>
Date: Sun, 10 Jul 2011 19:12:20 -0700 (PDT)
Local: Sun, Jul 10 2011 10:12 pm
Subject: Re: Autocompleter remote call?
I know I'm kinda resurrecting an dead thread here (frankly, they're
all a bit dead)...

I've been tackling this remote autocompleter problem as I'd like to
use scripty2 for a new project, but need this feature (and an in-place-
editor). I've looked at your code (@mcurtis), and think there is a
simpler way that doesn't require a fork, which I would prefer as it's
more future-proof.

// This declaration is the same as the second functional test
// (the one w/ objects), except that a) choices starts as empty
// and b) choiceValue can return null.
var ac = new S2.UI.Autocompleter('autocomplete', {
    choices: [],
    choiceValue: function(choice) { return choice ? choice.name :
null; },
    choiceTemplate: (new Template('#{text} <em>(#{object.login})</
em>'))
 });

// Override findChoices for remote call
ac.findChoices = function () {
        new Ajax.Request('/person/autocomplete2?
search='+this.input.getValue(), {
        // TODO: use prototype's Ajax.Responders for spinner
                onSuccess: function(response){
                        this.setChoices(response.responseJSON);
                }.bind(ac)
        });

}.bind(ac);

My gotchas were these: 1) I've been away from javascript for a while,
and forgot that Prototype's evalJSON() requires key names to be in
double quotes,  (2) to set my content-type to 'application/json', (3)
forgetting to include the CSS theme package from the functional test.

I'm still grappling with a third frustration, which is that in Safari
(v5.05) the created menu is offset by the applied style value of left
& top. It seems the positioning is not correct when the defer()-ed
placement function is run (which is after dom:load, according to the
console output order), but is correct by the time window.load is
handled. (There is no issue in Firefox 5; the order is different: the
layout defer() runs before dom:load, but the layout info is still
correct at both times.)

Originally, I only saw this behavior when using the Ajax version;
everything was correctly placed when using the local version--however,
I've been able to duplicate it for the local version too, so I'm
wondering if there is a race condition between the rendering needed
for getLayout() and defer().

TAG

On Apr 7, 3:05 pm, "m.curtis" <m.cur...@me.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »