This content has been marked as final.
Show 2 replies
-
1. Re: preventing duplicate rerendering when using <a4j:poll...
sergeysmirnov Jul 2, 2007 4:46 PM (in response to jgreene)if you define queue name for your Ajax tag, Ajax4jsf will send only latest "similar" Ajax request. "Similar" means the request generated by the same javascript event (like onkeyup, onclick, onmouseout etc).
For example, You have.... <h:inputText value="#{bean.text}"> <a4j:support event="onkeyup" eventsQueue="myqueue" requestDelay="1000" reRender="panel" /> </h:inputText> ... <h:panelGrid id="panel"> ... </h:panelGrid> ...
If user types "foo" during 1 sec. only one request with "foo" string will be sent (but not three of them with "f", "fo", "foo").
What if user continues to type while the request is on the way to server and back to client?
ignoreDupResponses allows to ignore the response with "foo" if user already types "foobar". I.e. the response is ignored if the queue already contains the "similar" request.
This is like this stuff works.
As you see, there is nothing about comparing the old content with the new content. This is out of scope for Ajax4jsf.
If you know the criteria when the content is changed on the level of your application you can manipulate with reRender attribute on the server side.
I.e. if you say reRender="#{bean.updateList}" you can have getUpdateList() method that returns list of re-rendered components. So, if this list is empty, nothing will be updated on the client side when the Ajax response is done. -
2. Re: preventing duplicate rerendering when using <a4j:poll...
jgreene Jul 3, 2007 8:50 AM (in response to jgreene)Thanks, Sergey -
Yes, after my first post, I thought of the same thing you suggested at the end of your post. I'll try using the reRender attribute, and have a list of ids to update. In the bean, I'll make the list empty if nothing has changed. sounds exactly like what you suggested. Sounds like it should work.