Hello,

 

I'm using the ZoneUpdater mixin from 
http://tinybits.blogspot.com/2009/05/update-zone-on-any-client-side-event.html 
to 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

Reply via email to