Is there a way to throttle the firing of updater requests easily with Prototype? Thanks, mark
In the options argument you have the following options (http://www.sergiopereira.com/articles/prototype.js.html ) and you will want to use Ajax.PeriodicalUpdater w/ the last options: The options argument object An important part of the AJAX operations is the options argument. There''s no options class per se. Any object can be passed, as long as it has the expected properties. It is common to create anonymous objects just for the AJAX calls. Property Type Default Description method String ''post'' Method of the HTTP request parameters String '''' The url-formatted list of values passed to the request asynchronous Boolean true Indicates if the AJAX call will be made asynchronously postBody String undefined Content passed to in the request''s body in case of a HTTP POST requestHeaders Array undefined List of HTTP headers to be passed with the request. This list must have an even number of items, any odd item is the name of a custom header, and the following even item is the string value of that header. Example:[''my-header1'', ''this is the value'', ''my-other-header'', ''another value''] onXXXXXXXX Function(XMLHttpRequest, Object) undefined Custom function to be called when the respective event/status is reached during the AJAX call. Example var myOpts = {onComplete: showResponse, onLoaded: registerLoaded};. The function used will receive one argument, containing the XMLHttpRequest object that is carrying the AJAX operation and another argument containing the evaluated X-JSON response HTTP header. onSuccess Function(XMLHttpRequest, Object) undefined Custom function to be called when the AJAX call completes successfully. The function used will receive one argument, containing the XMLHttpRequest object that is carrying the AJAX operation and another argument containing the evaluated X-JSON response HTTP header. onFailure Function(XMLHttpRequest, Object) undefined Custom function to be called when the AJAX call completes with error. The function used will receive one argument, containing the XMLHttpRequest object that is carrying the AJAX operation and another argument containing the evaluated X-JSON response HTTP header. onException Function(Ajax.Request, exception) undefined Custom function to be called when an exceptional condition happens on the client side of the AJAX call, like an invalid response or invalid arguments. The function used will receive two arguments, containing the Ajax.Request object that wraps the AJAX operation and the exception object. insertion an Insertion class undefined A class that will determine how the new content will be inserted. It can be Insertion.Before, Insertion.Top, Insertion.Bottom, or Insertion.After. Applies only to Ajax.Updater objects. evalScripts Boolean undefined, false Determines if script blocks will be evaluated when the response arrives. Applies only to Ajax.Updater objects. decay Number undefined, 1 Determines the progressive slowdown in a Ajax.PeriodicalUpdater object refresh rate when the received response is the same as the last one. For example, if you use 2, after one of the refreshes produces the same result as the previous one, the object will wait twice as much time for the next refresh. If it repeats again, the object will wait four times as much, and so on. Leave it undefined or use 1 to avoid the slowdown. frequency Number undefined, 2 Interval (not frequency) between refreshes, in seconds. Applies only to Ajax.PeriodicalUpdater objects. var myUpdater = new Ajax.PeriodicalUpdater( $(''itemId''), url, {frequency:1} ); -Andrew Martinez -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Mark McCray Sent: Tuesday, May 23, 2006 2:20 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] throttling... Is there a way to throttle the firing of updater requests easily with Prototype? Thanks, mark _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
HTML was stripped: go here: http://www.sergiopereira.com/articles/prototype.js.html#Ajax.options -Andrew Martinez -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Martinez, Andrew Sent: Tuesday, May 23, 2006 2:32 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] throttling... In the options argument you have the following options (http://www.sergiopereira.com/articles/prototype.js.html ) and you will want to use Ajax.PeriodicalUpdater w/ the last options: The options argument object An important part of the AJAX operations is the options argument. There''s no options class per se. Any object can be passed, as long as it has the expected properties. It is common to create anonymous objects just for the AJAX calls. Property Type Default Description method String ''post'' Method of the HTTP request parameters String '''' The url-formatted list of values passed to the request asynchronous Boolean true Indicates if the AJAX call will be made asynchronously postBody String undefined Content passed to in the request''s body in case of a HTTP POST requestHeaders Array undefined List of HTTP headers to be passed with the request. This list must have an even number of items, any odd item is the name of a custom header, and the following even item is the string value of that header. Example:[''my-header1'', ''this is the value'', ''my-other-header'', ''another value''] onXXXXXXXX Function(XMLHttpRequest, Object) undefined Custom function to be called when the respective event/status is reached during the AJAX call. Example var myOpts = {onComplete: showResponse, onLoaded: registerLoaded};. The function used will receive one argument, containing the XMLHttpRequest object that is carrying the AJAX operation and another argument containing the evaluated X-JSON response HTTP header. onSuccess Function(XMLHttpRequest, Object) undefined Custom function to be called when the AJAX call completes successfully. The function used will receive one argument, containing the XMLHttpRequest object that is carrying the AJAX operation and another argument containing the evaluated X-JSON response HTTP header. onFailure Function(XMLHttpRequest, Object) undefined Custom function to be called when the AJAX call completes with error. The function used will receive one argument, containing the XMLHttpRequest object that is carrying the AJAX operation and another argument containing the evaluated X-JSON response HTTP header. onException Function(Ajax.Request, exception) undefined Custom function to be called when an exceptional condition happens on the client side of the AJAX call, like an invalid response or invalid arguments. The function used will receive two arguments, containing the Ajax.Request object that wraps the AJAX operation and the exception object. insertion an Insertion class undefined A class that will determine how the new content will be inserted. It can be Insertion.Before, Insertion.Top, Insertion.Bottom, or Insertion.After. Applies only to Ajax.Updater objects. evalScripts Boolean undefined, false Determines if script blocks will be evaluated when the response arrives. Applies only to Ajax.Updater objects. decay Number undefined, 1 Determines the progressive slowdown in a Ajax.PeriodicalUpdater object refresh rate when the received response is the same as the last one. For example, if you use 2, after one of the refreshes produces the same result as the previous one, the object will wait twice as much time for the next refresh. If it repeats again, the object will wait four times as much, and so on. Leave it undefined or use 1 to avoid the slowdown. frequency Number undefined, 2 Interval (not frequency) between refreshes, in seconds. Applies only to Ajax.PeriodicalUpdater objects. var myUpdater = new Ajax.PeriodicalUpdater( $(''itemId''), url, {frequency:1} ); -Andrew Martinez -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Mark McCray Sent: Tuesday, May 23, 2006 2:20 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] throttling... Is there a way to throttle the firing of updater requests easily with Prototype? Thanks, mark _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Actually, here''s what i''m trying to do: I want the user to be able to type in some text in an input field and i only want the ajax request to happen after the user has stopped typing for 1 or two seconds. Kind of like how google suggest or autocompleter works. I can''t use the ajax autocompleter because we have a specific requirement that makes the autocompleter not work for us. Thanks, mark On May 23, 2006, at 2:37 PM, Martinez, Andrew wrote:> HTML was stripped: go here: http://www.sergiopereira.com/articles/ > prototype.js.html#Ajax.options > > -Andrew Martinez > > -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails- > spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Martinez, Andrew > Sent: Tuesday, May 23, 2006 2:32 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: RE: [Rails-spinoffs] throttling... > > In the options argument you have the following options (http:// > www.sergiopereira.com/articles/prototype.js.html ) and you will > want to use Ajax.PeriodicalUpdater w/ the last options: > > The options argument object > An important part of the AJAX operations is the options argument. > There''s no options class per se. Any object can be passed, as long > as it has the expected properties. It is common to create anonymous > objects just for the AJAX calls. > Property Type Default Description > method String ''post'' Method of the HTTP request > parameters String '''' The url-formatted list of values passed to the > request > asynchronous Boolean true Indicates if the AJAX call will be made > asynchronously > postBody String undefined Content passed to in the request''s body > in case of a HTTP POST > requestHeaders Array undefined List of HTTP headers to be passed > with the request. This list must have an even number of items, any > odd item is the name of a custom header, and the following even > item is the string value of that header. Example:[''my-header1'', > ''this is the value'', ''my-other-header'', ''another value''] > onXXXXXXXX Function(XMLHttpRequest, Object) undefined Custom > function to be called when the respective event/status is reached > during the AJAX call. Example var myOpts = {onComplete: > showResponse, onLoaded: registerLoaded};. The function used will > receive one argument, containing the XMLHttpRequest object that is > carrying the AJAX operation and another argument containing the > evaluated X-JSON response HTTP header. > onSuccess Function(XMLHttpRequest, Object) undefined Custom > function to be called when the AJAX call completes successfully. > The function used will receive one argument, containing the > XMLHttpRequest object that is carrying the AJAX operation and > another argument containing the evaluated X-JSON response HTTP header. > onFailure Function(XMLHttpRequest, Object) undefined Custom > function to be called when the AJAX call completes with error. The > function used will receive one argument, containing the > XMLHttpRequest object that is carrying the AJAX operation and > another argument containing the evaluated X-JSON response HTTP header. > onException Function(Ajax.Request, exception) undefined Custom > function to be called when an exceptional condition happens on the > client side of the AJAX call, like an invalid response or invalid > arguments. The function used will receive two arguments, containing > the Ajax.Request object that wraps the AJAX operation and the > exception object. > insertion an Insertion class undefined A class that will determine > how the new content will be inserted. It can be Insertion.Before, > Insertion.Top, Insertion.Bottom, or Insertion.After. Applies only > to Ajax.Updater objects. > evalScripts Boolean undefined, false Determines if script blocks > will be evaluated when the response arrives. Applies only to > Ajax.Updater objects. > decay Number undefined, 1 Determines the progressive slowdown in a > Ajax.PeriodicalUpdater object refresh rate when the received > response is the same as the last one. For example, if you use 2, > after one of the refreshes produces the same result as the previous > one, the object will wait twice as much time for the next refresh. > If it repeats again, the object will wait four times as much, and > so on. Leave it undefined or use 1 to avoid the slowdown. > frequency Number undefined, 2 Interval (not frequency) between > refreshes, in seconds. Applies only to Ajax.PeriodicalUpdater objects. > > > var myUpdater = new Ajax.PeriodicalUpdater( $(''itemId''), url, > {frequency:1} ); > > -Andrew Martinez > > -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails- > spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Mark McCray > Sent: Tuesday, May 23, 2006 2:20 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: [Rails-spinoffs] throttling... > > Is there a way to throttle the firing of updater requests easily with > Prototype? > Thanks, > mark > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >
I implemented my own autocompleter a long time ago. I couldn''t release it because my company technically owns it now. This is the way I did it: Set Up a Timer that start when the textField takes input (onFocus) Save the timer object and destroy it when the user leaves the field (onBlur) The timer should call a function that checks the user''s text. If the text is longer than the last known stored value OR it is different than the last stored value attempt to suggest -Andrew Martinez -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Mark McCray Sent: Tuesday, May 23, 2006 2:55 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails-spinoffs] throttling... Actually, here''s what i''m trying to do: I want the user to be able to type in some text in an input field and i only want the ajax request to happen after the user has stopped typing for 1 or two seconds. Kind of like how google suggest or autocompleter works. I can''t use the ajax autocompleter because we have a specific requirement that makes the autocompleter not work for us. Thanks, mark On May 23, 2006, at 2:37 PM, Martinez, Andrew wrote:> HTML was stripped: go here: http://www.sergiopereira.com/articles/ > prototype.js.html#Ajax.options > > -Andrew Martinez > > -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails- > spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Martinez, Andrew > Sent: Tuesday, May 23, 2006 2:32 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: RE: [Rails-spinoffs] throttling... > > In the options argument you have the following options (http:// > www.sergiopereira.com/articles/prototype.js.html ) and you will > want to use Ajax.PeriodicalUpdater w/ the last options: > > The options argument object > An important part of the AJAX operations is the options argument. > There''s no options class per se. Any object can be passed, as long > as it has the expected properties. It is common to create anonymous > objects just for the AJAX calls. > Property Type Default Description > method String ''post'' Method of the HTTP request > parameters String '''' The url-formatted list of values passed to the > request > asynchronous Boolean true Indicates if the AJAX call will be made > asynchronously > postBody String undefined Content passed to in the request''s body > in case of a HTTP POST > requestHeaders Array undefined List of HTTP headers to be passed > with the request. This list must have an even number of items, any > odd item is the name of a custom header, and the following even > item is the string value of that header. Example:[''my-header1'', > ''this is the value'', ''my-other-header'', ''another value''] > onXXXXXXXX Function(XMLHttpRequest, Object) undefined Custom > function to be called when the respective event/status is reached > during the AJAX call. Example var myOpts = {onComplete: > showResponse, onLoaded: registerLoaded};. The function used will > receive one argument, containing the XMLHttpRequest object that is > carrying the AJAX operation and another argument containing the > evaluated X-JSON response HTTP header. > onSuccess Function(XMLHttpRequest, Object) undefined Custom > function to be called when the AJAX call completes successfully. > The function used will receive one argument, containing the > XMLHttpRequest object that is carrying the AJAX operation and > another argument containing the evaluated X-JSON response HTTP header. > onFailure Function(XMLHttpRequest, Object) undefined Custom > function to be called when the AJAX call completes with error. The > function used will receive one argument, containing the > XMLHttpRequest object that is carrying the AJAX operation and > another argument containing the evaluated X-JSON response HTTP header. > onException Function(Ajax.Request, exception) undefined Custom > function to be called when an exceptional condition happens on the > client side of the AJAX call, like an invalid response or invalid > arguments. The function used will receive two arguments, containing > the Ajax.Request object that wraps the AJAX operation and the > exception object. > insertion an Insertion class undefined A class that will determine > how the new content will be inserted. It can be Insertion.Before, > Insertion.Top, Insertion.Bottom, or Insertion.After. Applies only > to Ajax.Updater objects. > evalScripts Boolean undefined, false Determines if script blocks > will be evaluated when the response arrives. Applies only to > Ajax.Updater objects. > decay Number undefined, 1 Determines the progressive slowdown in a > Ajax.PeriodicalUpdater object refresh rate when the received > response is the same as the last one. For example, if you use 2, > after one of the refreshes produces the same result as the previous > one, the object will wait twice as much time for the next refresh. > If it repeats again, the object will wait four times as much, and > so on. Leave it undefined or use 1 to avoid the slowdown. > frequency Number undefined, 2 Interval (not frequency) between > refreshes, in seconds. Applies only to Ajax.PeriodicalUpdater objects. > > > var myUpdater = new Ajax.PeriodicalUpdater( $(''itemId''), url, > {frequency:1} ); > > -Andrew Martinez > > -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails- > spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Mark McCray > Sent: Tuesday, May 23, 2006 2:20 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: [Rails-spinoffs] throttling... > > Is there a way to throttle the firing of updater requests easily with > Prototype? > Thanks, > mark > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
On Tuesday 23 May 2006 11:54, Mark McCray wrote:> Actually, > here''s what i''m trying to do: > > I want the user to be able to type in some text in an input field and > i only want the ajax request to happen after the user has stopped > typing for 1 or two seconds. Kind of like how google suggest or > autocompleter works. I can''t use the ajax autocompleter because we > have a specific requirement that makes the autocompleter not work for > us.and what requirement might that be? I subclassed the autocompleter to make it handle the server returning an xml document instead of a bunch of li tags... if you can tell us what you need the autocompleter to do, perhaps we can help you do it. the reason I ask this is because the autocompleter already has that throttling built in, so why reinvent the wheel? (although, if in the end you really do have to reinvent the wheel, just check out the autocompleter''s code and you''ll find a good example) -Jeremy -- Jeremy Kitchen ++ kitchen-RA8HwDor7flnDGu+y90WmgC/G2K4zDHf@public.gmane.org http://ipaction.org/ -- defend your rights to fair use _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
What we have is this: A search box: ________ Then we have a box where put in all of the results of the search goes: ********************** * * ********************** (The thing with the box is that, if there isn''t anything inside the search box, the results should show all available keywords. So the search box is acting more like a filter i guess.) Then in the box with all the search results, we want to be able to click on a word and have it populate a multiple select box. So whatever you click in the results box ends up in a multiselect box. The multiselect boxes get saved on a receiving page. The results box is really a list of metadata keywords. And the search box really filters that stuff down. The user needs to be presented with all options before filtering, which is different than how i''ve used the ajax.autocompleter before. I hope this makes sense. And thanks for the help. Mark On May 23, 2006, at 4:01 PM, Jeremy Kitchen wrote:> On Tuesday 23 May 2006 11:54, Mark McCray wrote: >> Actually, >> here''s what i''m trying to do: >> >> I want the user to be able to type in some text in an input field and >> i only want the ajax request to happen after the user has stopped >> typing for 1 or two seconds. Kind of like how google suggest or >> autocompleter works. I can''t use the ajax autocompleter because we >> have a specific requirement that makes the autocompleter not work for >> us. > > and what requirement might that be? I subclassed the autocompleter > to make it > handle the server returning an xml document instead of a bunch of > li tags... > > if you can tell us what you need the autocompleter to do, perhaps > we can help > you do it. > > the reason I ask this is because the autocompleter already has that > throttling > built in, so why reinvent the wheel? (although, if in the end you > really do > have to reinvent the wheel, just check out the autocompleter''s code > and > you''ll find a good example) > > -Jeremy > > -- > Jeremy Kitchen ++ kitchen-RA8HwDor7flnDGu+y90WmgC/G2K4zDHf@public.gmane.org > > http://ipaction.org/ -- defend your rights to fair use > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Use Form.Element.DelayedObserver (which is in script.aculo.us'' controls.js), which does exactly this (it takes a delay argument to control the amount of time after typing has stopped, normally it uses 1/2 second). -Thomas Am 23.05.2006 um 20:54 schrieb Mark McCray:> Actually, > here''s what i''m trying to do: > > I want the user to be able to type in some text in an input field > and i only want the ajax request to happen after the user has > stopped typing for 1 or two seconds. Kind of like how google > suggest or autocompleter works. I can''t use the ajax autocompleter > because we have a specific requirement that makes the autocompleter > not work for us. > > Thanks, > mark > > On May 23, 2006, at 2:37 PM, Martinez, Andrew wrote: > >> HTML was stripped: go here: http://www.sergiopereira.com/articles/ >> prototype.js.html#Ajax.options >> >> -Andrew Martinez >> >> -----Original Message----- >> From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails- >> spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Martinez, >> Andrew >> Sent: Tuesday, May 23, 2006 2:32 PM >> To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> Subject: RE: [Rails-spinoffs] throttling... >> >> In the options argument you have the following options (http:// >> www.sergiopereira.com/articles/prototype.js.html ) and you will >> want to use Ajax.PeriodicalUpdater w/ the last options: >> >> The options argument object >> An important part of the AJAX operations is the options argument. >> There''s no options class per se. Any object can be passed, as long >> as it has the expected properties. It is common to create >> anonymous objects just for the AJAX calls. >> Property Type Default Description >> method String ''post'' Method of the HTTP request >> parameters String '''' The url-formatted list of values passed to >> the request >> asynchronous Boolean true Indicates if the AJAX call will be made >> asynchronously >> postBody String undefined Content passed to in the request''s body >> in case of a HTTP POST >> requestHeaders Array undefined List of HTTP headers to be passed >> with the request. This list must have an even number of items, any >> odd item is the name of a custom header, and the following even >> item is the string value of that header. Example:[''my-header1'', >> ''this is the value'', ''my-other-header'', ''another value''] >> onXXXXXXXX Function(XMLHttpRequest, Object) undefined Custom >> function to be called when the respective event/status is reached >> during the AJAX call. Example var myOpts = {onComplete: >> showResponse, onLoaded: registerLoaded};. The function used will >> receive one argument, containing the XMLHttpRequest object that is >> carrying the AJAX operation and another argument containing the >> evaluated X-JSON response HTTP header. >> onSuccess Function(XMLHttpRequest, Object) undefined Custom >> function to be called when the AJAX call completes successfully. >> The function used will receive one argument, containing the >> XMLHttpRequest object that is carrying the AJAX operation and >> another argument containing the evaluated X-JSON response HTTP >> header. >> onFailure Function(XMLHttpRequest, Object) undefined Custom >> function to be called when the AJAX call completes with error. The >> function used will receive one argument, containing the >> XMLHttpRequest object that is carrying the AJAX operation and >> another argument containing the evaluated X-JSON response HTTP >> header. >> onException Function(Ajax.Request, exception) undefined Custom >> function to be called when an exceptional condition happens on the >> client side of the AJAX call, like an invalid response or invalid >> arguments. The function used will receive two arguments, >> containing the Ajax.Request object that wraps the AJAX operation >> and the exception object. >> insertion an Insertion class undefined A class that will determine >> how the new content will be inserted. It can be Insertion.Before, >> Insertion.Top, Insertion.Bottom, or Insertion.After. Applies only >> to Ajax.Updater objects. >> evalScripts Boolean undefined, false Determines if script blocks >> will be evaluated when the response arrives. Applies only to >> Ajax.Updater objects. >> decay Number undefined, 1 Determines the progressive slowdown in a >> Ajax.PeriodicalUpdater object refresh rate when the received >> response is the same as the last one. For example, if you use 2, >> after one of the refreshes produces the same result as the >> previous one, the object will wait twice as much time for the next >> refresh. If it repeats again, the object will wait four times as >> much, and so on. Leave it undefined or use 1 to avoid the slowdown. >> frequency Number undefined, 2 Interval (not frequency) between >> refreshes, in seconds. Applies only to Ajax.PeriodicalUpdater >> objects. >> >> >> var myUpdater = new Ajax.PeriodicalUpdater( $(''itemId''), url, >> {frequency:1} ); >> >> -Andrew Martinez >> >> -----Original Message----- >> From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails- >> spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Mark McCray >> Sent: Tuesday, May 23, 2006 2:20 PM >> To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> Subject: [Rails-spinoffs] throttling... >> >> Is there a way to throttle the firing of updater requests easily with >> Prototype? >> Thanks, >> mark >> >> >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs-- Thomas Fuchs wollzelle http://www.wollzelle.com http://www.fluxiom.com :: online digital asset management http://script.aculo.us :: Web 2.0 JavaScript http://mir.aculo.us :: Where no web developer has gone before
So did you ever get that working? (i.e. figure out how to display all results before anything has been typed). On 5/23/06, Mark McCray <mark-wW0Vl/WvSWEsV2N9l4h3zg@public.gmane.org> wrote:> > What we have is this: > A search box: > ________ > > Then we have a box where put in all of the results of the search goes: > ********************** > * * > ********************** > (The thing with the box is that, if there isn''t anything inside the > search box, the results should show all available keywords. So the > search box is acting more like a filter i guess.) > > Then in the box with all the search results, we want to be able to > click on a word and have it populate a multiple select box. > So whatever you click in the results box ends up in a multiselect > box. The multiselect boxes get saved on a receiving page. > > > The results box is really a list of metadata keywords. And the search > box really filters that stuff down. The user needs to be presented > with all options before filtering, which is different than how i''ve > used the ajax.autocompleter before. > > I hope this makes sense. > And thanks for the help. > Mark > > On May 23, 2006, at 4:01 PM, Jeremy Kitchen wrote: > > > On Tuesday 23 May 2006 11:54, Mark McCray wrote: > >> Actually, > >> here''s what i''m trying to do: > >> > >> I want the user to be able to type in some text in an input field and > >> i only want the ajax request to happen after the user has stopped > >> typing for 1 or two seconds. Kind of like how google suggest or > >> autocompleter works. I can''t use the ajax autocompleter because we > >> have a specific requirement that makes the autocompleter not work for > >> us. > > > > and what requirement might that be? I subclassed the autocompleter > > to make it > > handle the server returning an xml document instead of a bunch of > > li tags... > > > > if you can tell us what you need the autocompleter to do, perhaps > > we can help > > you do it. > > > > the reason I ask this is because the autocompleter already has that > > throttling > > built in, so why reinvent the wheel? (although, if in the end you > > really do > > have to reinvent the wheel, just check out the autocompleter''s code > > and > > you''ll find a good example) > > > > -Jeremy > > > > -- > > Jeremy Kitchen ++ kitchen-RA8HwDor7flnDGu+y90WmgC/G2K4zDHf@public.gmane.org > > > > http://ipaction.org/ -- defend your rights to fair use > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
He contacted me via email outside of the mailing list. The auto completer in scriptaculous couldn''t provide the functionality he needed. I gave him the general design of what I did way before the scriptaculous auto completer came out. He said thanks and ran I think. Sorry you guys sort of got lost in the shuffle. -Andrew Martinez -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On Behalf Of Jeoff Wilks Sent: Wednesday, May 31, 2006 7:49 AM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails-spinoffs] throttling... So did you ever get that working? (i.e. figure out how to display all results before anything has been typed). On 5/23/06, Mark McCray < <mailto:mark-wW0Vl/WvSWEsV2N9l4h3zg@public.gmane.org> mark-wW0Vl/WvSWEsV2N9l4h3zg@public.gmane.org> wrote: What we have is this: A search box: ________ Then we have a box where put in all of the results of the search goes: ********************** * * ********************** (The thing with the box is that, if there isn''t anything inside the search box, the results should show all available keywords. So the search box is acting more like a filter i guess.) Then in the box with all the search results, we want to be able to click on a word and have it populate a multiple select box. So whatever you click in the results box ends up in a multiselect box. The multiselect boxes get saved on a receiving page. The results box is really a list of metadata keywords. And the search box really filters that stuff down. The user needs to be presented with all options before filtering, which is different than how i''ve used the ajax.autocompleter before. I hope this makes sense. And thanks for the help. Mark On May 23, 2006, at 4:01 PM, Jeremy Kitchen wrote:> On Tuesday 23 May 2006 11:54, Mark McCray wrote: >> Actually, >> here''s what i''m trying to do: >> >> I want the user to be able to type in some text in an input field and >> i only want the ajax request to happen after the user has stopped >> typing for 1 or two seconds. Kind of like how google suggest or >> autocompleter works. I can''t use the ajax autocompleter because we >> have a specific requirement that makes the autocompleter not work for >> us. > > and what requirement might that be? I subclassed the autocompleter > to make it > handle the server returning an xml document instead of a bunch of > li tags... > > if you can tell us what you need the autocompleter to do, perhaps > we can help > you do it. > > the reason I ask this is because the autocompleter already has that > throttling > built in, so why reinvent the wheel? (although, if in the end you > really do > have to reinvent the wheel, just check out the autocompleter''s code > and > you''ll find a good example) > > -Jeremy > > -- > Jeremy Kitchen ++ kitchen-RA8HwDor7flnDGu+y90WmgC/G2K4zDHf@public.gmane.org > > http://ipaction.org/ -- defend your rights to fair use > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Hey there, We''re going to try the FormElement.DelayedObserver thing and see how that goes. (Of course, we got put on something else more critical :) ) Will let you know how it works out. Mark On May 31, 2006, at 10:52 AM, Martinez, Andrew wrote:> He contacted me via email outside of the mailing list. The auto > completer in scriptaculous couldn’t provide the functionality he > needed. I gave him the general design of what I did way before the > scriptaculous auto completer came out. He said thanks and ran I think. > > > > Sorry you guys sort of got lost in the shuffle. > > > > -Andrew Martinez > > > > -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails- > spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On Behalf Of Jeoff Wilks > Sent: Wednesday, May 31, 2006 7:49 AM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: Re: [Rails-spinoffs] throttling... > > > > So did you ever get that working? (i.e. figure out how to display > all results before anything has been typed). > > On 5/23/06, Mark McCray < mark-wW0Vl/WvSWEsV2N9l4h3zg@public.gmane.org> wrote: > > What we have is this: > A search box: > ________ > > Then we have a box where put in all of the results of the search goes: > ********************** > * * > ********************** > (The thing with the box is that, if there isn''t anything inside the > search box, the results should show all available keywords. So the > search box is acting more like a filter i guess.) > > Then in the box with all the search results, we want to be able to > click on a word and have it populate a multiple select box. > So whatever you click in the results box ends up in a multiselect > box. The multiselect boxes get saved on a receiving page. > > > The results box is really a list of metadata keywords. And the search > box really filters that stuff down. The user needs to be presented > with all options before filtering, which is different than how i''ve > used the ajax.autocompleter before. > > I hope this makes sense. > And thanks for the help. > Mark > > On May 23, 2006, at 4:01 PM, Jeremy Kitchen wrote: > > > On Tuesday 23 May 2006 11:54, Mark McCray wrote: > >> Actually, > >> here''s what i''m trying to do: > >> > >> I want the user to be able to type in some text in an input > field and > >> i only want the ajax request to happen after the user has stopped > >> typing for 1 or two seconds. Kind of like how google suggest or > >> autocompleter works. I can''t use the ajax autocompleter because we > >> have a specific requirement that makes the autocompleter not > work for > >> us. > > > > and what requirement might that be? I subclassed the autocompleter > > to make it > > handle the server returning an xml document instead of a bunch of > > li tags... > > > > if you can tell us what you need the autocompleter to do, perhaps > > we can help > > you do it. > > > > the reason I ask this is because the autocompleter already has that > > throttling > > built in, so why reinvent the wheel? (although, if in the end you > > really do > > have to reinvent the wheel, just check out the autocompleter''s code > > and > > you''ll find a good example) > > > > -Jeremy > > > > -- > > Jeremy Kitchen ++ kitchen-RA8HwDor7flnDGu+y90WmgC/G2K4zDHf@public.gmane.org > > > > http://ipaction.org/ -- defend your rights to fair use > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Apparently Analagous Threads
- Begin with Autocompleter
- RE: Prototype: correct useage of onCompletewithAjax.PeriodicalUpdater
- Effect.Highlight on Ajax.Updater
- RE: Prototype: correct useage of onComplete withAjax.PeriodicalUpdater
- Autocompleter - up arrow moves cursor to start of input box