Hi, I am trying to create an Autocomplete.local...
However I am changing the data depending on what the user has selected,
so for example if they select the radio button Names it will run
new Autocompleter.Local(''txtNameSrch'',
''divContactsPik'', arNames,
{fullSearch: true, partialSearch: true});
if they select Addresses it will then run
new Autocompleter.Local(''txtNameSrch'',
''divContactsPik'', arAddresses,
{fullSearch: true, partialSearch: true});
Now without first running a Element.remove on the textbox and then
recreating it, it messes up the autocomplete box and pretty much breaks
it if I just run the "new" line again.
Is there a different way I should be doing this? is there a way to
change the autocompletes contents without re initializing the
autocomplete?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
o0JoeCool0o a écrit :> Is there a different way I should be doing this? is there a way to > change the autocompletes contents without re initializing the > autocomplete?It''s kinda relying on undocumented features, but this should do the trick: 1. create a map of radio button IDs to choice arrays 2. save your A.L reference 3. react to radio button selection by adjusting this ref''s options.array reference Something along those lines: var CHOICES = { rbtNames: arNames, rbtAddresses: arAddresses // etc. }; var gCompleter = null; function initPage() { gCompleter = new Autocompleter.Local(''txtSearch'', ''divContactsPik'', CHOICES.rbtNames, { fullSearch: true, partialSearch: true }); document.getElementsByClassName(''choiceButton'').each(function(rbt) { rbt.observe(''click'', updateChoices); }); } function updateChoices(e) { var rbt = Event.element(e); if (e.id in CHOICES) gCompleter.options.array = CHOICES[e.id]; } Event.observe(window, ''load'', initPage); Of course, this requires that your radio buttons feature at least the ''choiceButton'' CSS class, for easier selection and maintenance. Haven''t tried it, but from looking at s.a.us'' source, this should work. ''HTH -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Woopsie, Christophe Porteneuve a écrit :> function updateChoices(e) { > var rbt = Event.element(e); > if (e.id in CHOICES)^^^^> gCompleter.options.array = CHOICES[e.id];^^^^> }Of course, you''d have to write « rbt.id » instead. I''m sure you had figured it out :-) -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Thank you sooooooooooooooo much. The onyl thing i actualyl needed was gCompleter.options.array = arMembers I didnt knwo how to change the array after the fact. That is so awesome and fixed my code as I had one hack of a work around which would only work sometimes ;) Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Sorry I was also goign to ask do you know if there is a way to catch the selected event? so once they have selected an item from the autocomplete I can call a function ? and one more question is there a way to trigger the autocompelte drop down event? As currently if they type one letter in the box it then sends a request to the server using ajax and the server responds with the array and sets the autocomplete array but of course nothing drops down on the box at this point cause no key has been pressed since the array was set. On 11/13/06, o0JoeCool0o <o0JoeCool0o-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Thank you sooooooooooooooo much. The onyl thing i actualyl needed was > > gCompleter.options.array = arMembers > > I didnt knwo how to change the array after the fact. That is so awesome > and fixed my code as I had one hack of a work around which would only > work sometimes ;) > > Thanks! > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Why aren''t you using Ajax.Autocompleter then if you are using ajax? On 11/13/06, Joe Cool <o0joecool0o-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Sorry I was also goign to ask do you know if there is a way to catch the > selected event? so once they have selected an item from the autocomplete I > can call a function ? > > and one more question is there a way to trigger the autocompelte drop down > event? As currently if they type one letter in the box it then sends a > request to the server using ajax and the server responds with the array and > sets the autocomplete array but of course nothing drops down on the box at > this point cause no key has been pressed since the array was set. > > > On 11/13/06, o0JoeCool0o <o0JoeCool0o-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Thank you sooooooooooooooo much. The onyl thing i actualyl needed was > > > > gCompleter.options.array = arMembers > > > > I didnt knwo how to change the array after the fact. That is so awesome > > and fixed my code as I had one hack of a work around which would only > > work sometimes ;) > > > > Thanks! > > > > > > > > > > > >-- Ryan Gahl Application Development Consultant Athena Group, Inc. Inquire: 1-920-955-1457 Blog: http://www.someElement.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Because I am using AjaxPro.Net On 11/13/06, Ryan Gahl <ryan.gahl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Why aren''t you using Ajax.Autocompleter then if you are using ajax? > > On 11/13/06, Joe Cool <o0joecool0o-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote: > > > > Sorry I was also goign to ask do you know if there is a way to catch the > > selected event? so once they have selected an item from the autocomplete I > > can call a function ? > > > > and one more question is there a way to trigger the autocompelte drop > > down event? As currently if they type one letter in the box it then sends a > > request to the server using ajax and the server responds with the array and > > sets the autocomplete array but of course nothing drops down on the box at > > this point cause no key has been pressed since the array was set. > > > > > > On 11/13/06, o0JoeCool0o <o0JoeCool0o-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote: > > > > > > > > > Thank you sooooooooooooooo much. The onyl thing i actualyl needed was > > > > > > gCompleter.options.array = arMembers > > > > > > I didnt knwo how to change the array after the fact. That is so > > > awesome > > > and fixed my code as I had one hack of a work around which would only > > > work sometimes ;) > > > > > > Thanks! > > > > > > > > > > > > > > > > > > > > > -- > Ryan Gahl > Application Development Consultant > Athena Group, Inc. > Inquire: 1-920-955-1457 > Blog: http://www.someElement.com <http://www.someelement.com/> > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Well I just found some code in the Ajax.Autocompleter wiki that appears to
work with the local oen as well
{afterUpdateElement : getSelectionId}
allows you to specify a function to call after the selection is made... now
I just need to figure out hwo to trigger the autocomplete drop down from
code.
On 11/13/06, Joe Cool
<o0joecool0o-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> Because I am using AjaxPro.Net
>
> On 11/13/06, Ryan Gahl
<ryan.gahl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >
> > Why aren''t you using Ajax.Autocompleter then if you are using
ajax?
> >
> > On 11/13/06, Joe Cool
<o0joecool0o-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote:
> > >
> > > Sorry I was also goign to ask do you know if there is a way to
catch
> > > the selected event? so once they have selected an item from the
> > > autocomplete I can call a function ?
> > >
> > > and one more question is there a way to trigger the autocompelte
drop
> > > down event? As currently if they type one letter in the box it
then sends a
> > > request to the server using ajax and the server responds with the
array and
> > > sets the autocomplete array but of course nothing drops down on
the box at
> > > this point cause no key has been pressed since the array was set.
> > >
> > >
> > > On 11/13/06, o0JoeCool0o
<o0JoeCool0o-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote:
> > > >
> > > >
> > > > Thank you sooooooooooooooo much. The onyl thing i actualyl
needed
> > > > was
> > > >
> > > > gCompleter.options.array = arMembers
> > > >
> > > > I didnt knwo how to change the array after the fact. That is
so
> > > > awesome
> > > > and fixed my code as I had one hack of a work around which
would
> > > > only
> > > > work sometimes ;)
> > > >
> > > > Thanks!
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> > --
> > Ryan Gahl
> > Application Development Consultant
> > Athena Group, Inc.
> > Inquire: 1-920-955-1457
> > Blog: http://www.someElement.com <http://www.someelement.com/>
> > > >
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Try calling "getUpdatedChoices()" on your autocompleter after updating the array. However, you should also realize that you are using asynchronous behavior with a control that was not designed with asynch in mind (unless of course you are making synchronous ajax calls)... so you may run into issues with multiple calls queuing up. On 11/13/06, Joe Cool <o0joecool0o-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Well I just found some code in the Ajax.Autocompleter wiki that appears to > work with the local oen as well > > {afterUpdateElement : getSelectionId} > > allows you to specify a function to call after the selection is made... > now I just need to figure out hwo to trigger the autocomplete drop down from > code. > > On 11/13/06, Joe Cool <o0joecool0o-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Because I am using AjaxPro.Net > > > > On 11/13/06, Ryan Gahl <ryan.gahl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote: > > > > > > Why aren''t you using Ajax.Autocompleter then if you are using ajax? > > > > > > On 11/13/06, Joe Cool <o0joecool0o-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote: > > > > > > > > Sorry I was also goign to ask do you know if there is a way to catch > > > > the selected event? so once they have selected an item from the > > > > autocomplete I can call a function ? > > > > > > > > and one more question is there a way to trigger the autocompelte > > > > drop down event? As currently if they type one letter in the box it then > > > > sends a request to the server using ajax and the server responds with the > > > > array and sets the autocomplete array but of course nothing drops down on > > > > the box at this point cause no key has been pressed since the array was set. > > > > > > > > > > > > > > > > On 11/13/06, o0JoeCool0o <o0JoeCool0o-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote: > > > > > > > > > > > > > > > Thank you sooooooooooooooo much. The onyl thing i actualyl needed > > > > > was > > > > > > > > > > gCompleter.options.array = arMembers > > > > > > > > > > I didnt knwo how to change the array after the fact. That is so > > > > > awesome > > > > > and fixed my code as I had one hack of a work around which would > > > > > only > > > > > work sometimes ;) > > > > > > > > > > Thanks! > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > Ryan Gahl > > > Application Development Consultant > > > Athena Group, Inc. > > > Inquire: 1-920-955-1457 > > > Blog: http://www.someElement.com <http://www.someelement.com/> > > > > > > > > > > > >-- Ryan Gahl Application Development Consultant Athena Group, Inc. Inquire: 1-920-955-1457 Blog: http://www.someElement.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Im not sure how you mean to call getUpdateChoices() on my autocompleter I tried srchCompleter.getUpdateChoices(); but I get "object doesnt support this property or method", is this possibly an Ajax.Autocompleter only method? as for the asynch stuff, I do realize that which is why I only call the ajax method if it is the first letter typed in the box and character thereafter will not call anything so there is really no way it can mess up... that I can see anyway... Ive played with it quite a bit and it works perfectly now, except for the fact that it wont drop down the box until a second character is typed. The other thing I read with Ajax.Autocompleter, is that you can specify two parameters in your afterUpdateElement function one being the text and one being the li item. Apparently this only returns the textbox element in Autocompleter.Local it would be extremely handy to have it return li id numbers as well... Im not sure if im just missing something here or if it was jsut never built that way. On Nov 13, 2:14 pm, "Ryan Gahl" <ryan.g...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Try calling "getUpdatedChoices()" on your autocompleter after updating the > array. However, you should also realize that you are using asynchronous > behavior with a control that was not designed with asynch in mind (unless of > course you are making synchronous ajax calls)... so you may run into issues > with multiple calls queuing up. > > On 11/13/06, Joe Cool <o0joecoo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > Well I just found some code in the Ajax.Autocompleter wiki that appears to > > work with the local oen as well > > > {afterUpdateElement : getSelectionId} > > > allows you to specify a function to call after the selection is made... > > now I just need to figure out hwo to trigger the autocomplete drop down from > > code. > > > On 11/13/06, Joe Cool <o0joecoo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Because I am using AjaxPro.Net > > > > On 11/13/06, Ryan Gahl <ryan.g...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote: > > > > > Why aren''t you using Ajax.Autocompleter then if you are using ajax? > > > > > On 11/13/06, Joe Cool <o0joecoo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote: > > > > > > Sorry I was also goign to ask do you know if there is a way to catch > > > > > the selected event? so once they have selected an item from the > > > > > autocomplete I can call a function ? > > > > > > and one more question is there a way to trigger the autocompelte > > > > > drop down event? As currently if they type one letter in the box it then > > > > > sends a request to the server using ajax and the server responds with the > > > > > array and sets the autocomplete array but of course nothing drops down on > > > > > the box at this point cause no key has been pressed since the array was set. > > > > > > On 11/13/06, o0JoeCool0o <o0JoeCoo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote: > > > > > > > Thank you sooooooooooooooo much. The onyl thing i actualyl needed > > > > > > was > > > > > > > gCompleter.options.array = arMembers > > > > > > > I didnt knwo how to change the array after the fact. That is so > > > > > > awesome > > > > > > and fixed my code as I had one hack of a work around which would > > > > > > only > > > > > > work sometimes ;) > > > > > > > Thanks! > > > > > -- > > > > Ryan Gahl > > > > Application Development Consultant > > > > Athena Group, Inc. > > > > Inquire: 1-920-955-1457 > > > > Blog:http://www.someElement.com<http://www.someelement.com/>-- > Ryan Gahl > Application Development Consultant > Athena Group, Inc. > Inquire: 1-920-955-1457 > Blog:http://www.someElement.com- Hide quoted text -- Show quoted text ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
> > Im not sure how you mean to call getUpdateChoices() on my autocompleter...you''re missing a "d"... I said "getUpdatedChoices", not "getUpdateChoices" :-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hey, Well, I can''t say I''m confident you''re building this in a reasonably simple way, but what the heck. o0JoeCool0o a écrit :> Ive played with it quite a bit and it works perfectly now, except for > the fact that it wont drop down the box until a second character is > typed.Are you sure you don''t have a minChars: 2 option set? At any rate, your using Autocompleter.Local based on AJAXy calls does create a weirdness factor. I can''t say I''m surprised things are off-beat.> The other thing I read with Ajax.Autocompleter, is that you can > specify two parameters in your afterUpdateElement function one being > the text and one being the li item. > Apparently this only returns the textbox element in Autocompleter.Local > it would be extremely handy to have it return li id numbers as well...The afterUpdateElement callback works consistently across both autocompleters. So this behavior exists also for Autocompleter.Local. Just look at the source if in doubt! -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
>>Well, I can''t say I''m confident you''re building this in a reasonably >>simple way, but what the heck. >>Are you sure you don''t have a minChars: 2 option set?Yes Im sure I am nto using a minChars option.. I guess Ill go look through the source...>>At any rate, your >>using Autocompleter.Local based on AJAXy calls does create a weirdness >>factor. I can''t say I''m surprised things are off-beat.Im not sure I see where your oppinion of my code being "offbeat" and using "Wierd Ajaxy Calls" is based on... but id be happy to show you an example on the power of using AjaxPro.Netcombined with Scriptaculous controls. Anyway I think its quite simple how i am using the local control. Ajaxpro is very simple to use I call a server side function and I can return any object I like, be it a dataset or an array through .NET and is at this point ajaxpro.net is 5 times faster then Microsofts Atlas Ajax functions. What I have done to maximize performance is simply return all records in a database starting with the first letter they type in the box as opposed to returning EVERY record in the database. This brings the result down from 5000 records to like 500 maybe less. The only disadvantage to this is if using a full true partial true option then you of course wont find a result if it didnt start with the letter you first typed in the box. which is ok by me. Now the problem is simple, if you type the first letter in the autocomplete INPUT box it then grabs those 500 records as an array and changes the autocompleter array to those 500 records. well because we jsut changed that array its not going to drop down the selection div until we type another letter triggering it to do so. If my wierd ajaxy problem still makes no sense Ill just try the digging through the source. Im sure there must be a way to trigger the drop down box. On 11/13/06, Christophe Porteneuve <tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote:> > > Hey, > > Well, I can''t say I''m confident you''re building this in a reasonably > simple way, but what the heck. > > o0JoeCool0o a écrit : > > Ive played with it quite a bit and it works perfectly now, except for > > the fact that it wont drop down the box until a second character is > > typed. > > Are you sure you don''t have a minChars: 2 option set? At any rate, your > using Autocompleter.Local based on AJAXy calls does create a weirdness > factor. I can''t say I''m surprised things are off-beat. > > > The other thing I read with Ajax.Autocompleter, is that you can > > specify two parameters in your afterUpdateElement function one being > > the text and one being the li item. > > Apparently this only returns the textbox element in Autocompleter.Local > > it would be extremely handy to have it return li id numbers as well... > > The afterUpdateElement callback works consistently across both > autocompleters. So this behavior exists also for Autocompleter.Local. > > Just look at the source if in doubt! > > -- > Christophe Porteneuve a.k.a. TDD > "[They] did not know it was impossible, so they did it." --Mark Twain > Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
here is my code so it can amke more sense. There is one funciton for
calling my ajax method and one that recieves the result of my ajax call
function srchContacts(ele)
{
//get all contact names beginning with letter
var srchField = "";
var firstLetter = "";
firstLetter = ele.value.charAt(0);
srchField = document.getElementById("ddConSrchField").value;
if (ele.value.length == 1 && lastlength == 0)
{
AjaxMethodsEC.srchContacts(firstLetter, srchField,
callback_srchContacts);
}
lastlength = ele.value.length;
}
function callback_srchContacts(res)
{
//loop through result and create an array for the autocompleter
var arMembers = [];
chkError(res);
if(res != null && res.value != null)
{
dtResults = res.value;
for(var i=0; i<dtResults.Rows.length; i++)
{
arMembers[arMembers.length] = dtResults.Rows[i].ID + "||" +
dtResults.Rows[i].Name + "||" + dtResults.Rows[i].EmailAddress;
}
}
srchCompleter.options.array = arMembers;
}
On Nov 13, 5:30 pm, "Joe Cool"
<o0joecoo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> >>Well, I can''t say I''m confident you''re
building this in a reasonably
> >>simple way, but what the heck.
> >>Are you sure you don''t have a minChars: 2 option set?Yes
Im sure I am nto using a minChars option..
> I guess Ill go look through the source...
>
> >>At any rate, your
> >>using Autocompleter.Local based on AJAXy calls does create a
weirdness
> >>factor. I can''t say I''m surprised things are
off-beat.Im not sure I see where your oppinion of my code being
"offbeat" and using
> "Wierd Ajaxy Calls" is based on...
> but id be happy to show you an example on the power of using
> AjaxPro.Netcombined with Scriptaculous controls.
>
> Anyway I think its quite simple how i am using the local control. Ajaxpro
is
> very simple to use I call a server side function and I can return any
object
> I like, be it a dataset or an array through .NET and is at this point
> ajaxpro.net is 5 times faster then Microsofts Atlas Ajax functions.
>
> What I have done to maximize performance is simply return all records in a
> database starting with the first letter they type in the box as opposed to
> returning EVERY record in the database. This brings the result down from
> 5000 records to like 500 maybe less. The only disadvantage to this is if
> using a full true partial true option then you of course wont find a result
> if it didnt start with the letter you first typed in the box. which is ok
by
> me.
>
> Now the problem is simple, if you type the first letter in the
> autocomplete INPUT box it then grabs those 500 records as an array and
> changes the autocompleter array to those 500 records. well because we jsut
> changed that array its not going to drop down the selection div until we
> type another letter triggering it to do so.
>
> If my wierd ajaxy problem still makes no sense Ill just try the digging
> through the source. Im sure there must be a way to trigger the drop down
> box.
>
> On 11/13/06, Christophe Porteneuve
<t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote:
>
>
>
>
>
> > Hey,
>
> > Well, I can''t say I''m confident you''re
building this in a reasonably
> > simple way, but what the heck.
>
> > o0JoeCool0o a écrit :
> > > Ive played with it quite a bit and it works perfectly now, except
for
> > > the fact that it wont drop down the box until a second character
is
> > > typed.
>
> > Are you sure you don''t have a minChars: 2 option set? At any
rate, your
> > using Autocompleter.Local based on AJAXy calls does create a weirdness
> > factor. I can''t say I''m surprised things are
off-beat.
>
> > > The other thing I read with Ajax.Autocompleter, is that you can
> > > specify two parameters in your afterUpdateElement function one
being
> > > the text and one being the li item.
> > > Apparently this only returns the textbox element in
Autocompleter.Local
> > > it would be extremely handy to have it return li id numbers as
well...
>
> > The afterUpdateElement callback works consistently across both
> > autocompleters. So this behavior exists also for Autocompleter.Local.
>
> > Just look at the source if in doubt!
>
> > --
> > Christophe Porteneuve a.k.a. TDD
> > "[They] did not know it was impossible, so they did it."
--Mark Twain
> > Email: t...-x+CfDp/qHesRuZII/U6RgQ@public.gmane.org Hide quoted text
-- Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---