Hi,
you can make any Ajax behavior stateless as follows:
component.setMarkupId("stable-id");
add(component);
component.add(new
AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)) {
@Override
public boolean getStatelessHint(Component component) {
return true;
}
});
Note that you have to use a stable markup id for the component,
otherwise it cannot be updated.
Have fun
Sven
On 23.06.20 17:21, Zbynek Vavros wrote:
Hi,
We have a page with AjaxSelfUpdatingTimerBehavior and now one of our
customers is complaining about "weird" behavior when this page is opened in
multiple browser tabs (yeah yeah we told him not to do it...).
What happens is that after opening this page in new tab, the previous tab
gets ajax redirect on mentioned timer.
After some digging I found out that this is happening because the page is
stateful.
Excerpt from Wicket code:
// If the page is stateful then we cannot assume that the listener
interface is
// invoked on its initial state (right after page initialization) and that
its
// component and/or behavior will be available. That's why the listener
interface
// should be ignored and the best we can do is to re-paint the newly
constructed
// page.
I did use StatelessChecker (very useful!) and found out that the reason is
this AjaxSelfUpdatingTimerBehavior.
Googling around I found this thread from 2011 -
http://apache-wicket.1842946.n4.nabble.com/Stateless-page-with-an-auto-update-section-td3795927.html.
The suggestion here is to "roll your own timer behavior".
Well, I spent some time with Wicket already but this is beyond my
knowledge. Can anyone please point me the right direction? Is this even
possible? I just have to say the AjaxSelfUpdatingTimerBehavior must stay -
this page displays progress bar of background task that is non-negotiable.
Thanks,
Zbynek
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org