to abort the ajax call sounds very very good. But i don't know where i can do this in Tapestry because Tapestry does the whole AJAX XMLHttpRequest thing
-----Ursprüngliche Nachricht----- Von: kamiseq [mailto:kami...@gmail.com] Gesendet: Mittwoch, 17. Februar 2010 15:15 An: Tapestry users Betreff: Re: ZoneUpdater and Zone Race-Condition maybe instead of timestamp you may try to return json/xml with pattern as key and data as value, so you will match key with what you actually are looking for. why can't you just abort the request if new char has been hit http://javascript.about.com/library/blajax11.htm <http://javascript.about.com/library/blajax11.htm> http://www.bennadel.com/blog/1002-XMLHttpRequest-Object-Has-An-Abort-Method.htm <http://www.bennadel.com/blog/1002-XMLHttpRequest-Object-Has-An-Abort-Method.htm>jquery : http://stackoverflow.com/questions/600494/jquery-automatically-abort-ajaxrequests-on-page-unload <http://stackoverflow.com/questions/600494/jquery-automatically-abort-ajaxrequests-on-page-unload>maybe you should wait few seconds after last char has been entered to give a time to enter next time before you send request pozdrawiam Paweł Kamiński kami...@gmail.com pkaminski....@gmail.com ______________________ On 17 February 2010 14:00, Dominik Gätjens <dominik.gaetj...@leomedia.eu>wrote: > Hello, > > > > I'm using the ZoneUpdater mixin from > http://tinybits.blogspot.com/2009/05/update-zone-on-any-client-side-event.htmlto > send an event at every keyup event on a textfield. > > This event triggers a webservice-method to fetch some data into a zone. > > if u type "ab" the a fires an event and starts to rerender the Zone with > getData("a"). This takes a long time about 30-40 seconds. The second event > getData("ab") is much faster about 1 second. So what happen ist hat you see > the result from getData(ab) in the Zone and after a few seconds it changes > to the result of getData(a). > > > > I need any chance to abort the first request or to return the the data of > the second (getData(ab)) request again. > > > > I tried to cache the last result with a timestamp in the Session. But it > looks like that @Persist fields are restored at page actiavation and don't > reflect any changes made in the session. > > > > Here ist the important code: > > > > <t:form t:zone="ligen" t:id="keyForm"> > > <t:textfield t:id="key" t:mixins="zoneUpdater" clientEvent="keyup" > event="keyup" t:zone="ligen"/> > > <input type="submit"></input> > > </t:form> > > > > <t:zone t:id="ligen"> > > <t:loop source="ligen" value="liga"> > > ${liga.key} > > </t:loop> > > </t:zone> > > > > @Property > > private Liga liga; > > @Property > > @Persist > > private String key > > > > > > public Object onKeyup(String value) { > > key = value; > > return new MultiZoneUpdate("ligen", ligen.getBody()); > > } > > > > > > public List<Liga> getLigen() { > > if(key==null || key.equals("")) return new ArrayList<Liga>(); > > List<Liga> list = ligaDAO.getLigenByKey(key); //may need a lot > of time > > if(list==null){ > > list = new ArrayList<Liga>(); > > } > > return list; > > } > > > > > > Dominik > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org