Ajax calls and jGrowl component

194 views
Skip to first unread message

Matías Blasi

unread,
Aug 17, 2012, 12:49:10 PM8/17/12
to tapestry...@googlegroups.com
Hi all,

Did you think in some mechanism for updating the jGrowl component in the client-side after every ajax request?

I have ajax requests that generate some messages... so it would be useful to update the jGrowl... I tried by adding:

if(request.isXHR()) {
JavaScriptCallback callback = new JavaScriptCallback() {
@Override
public void run(JavaScriptSupport javascriptSupport) {
                                                                //Forcing click in an action link which updates a zone wrapping the jGrowl component
javascriptSupport.addScript(InitializationPriority.LATE, "$('#refreshClientMessages').click()");
}
};
ajaxRenderer.addCallback(callback);
}

I put that in a request filter, but it didn't work, I am getting:

"Unexpected error: Page must be specified before initializing for partial page render."

I hope you have a better alternative.

Regards,
Matías.

Emmanuel DEMEY

unread,
Aug 17, 2012, 3:00:34 PM8/17/12
to tapestry...@googlegroups.com
You have this error when you visit for the firt time the page, or after the ajax request ?

2012/8/17 Matías Blasi <matias...@gmail.com>



--
Emmanuel DEMEY
Ingénieur Etude et Développement
ATOS Worldline
+33 (0)6 47 47 42 02
demey.e...@gmail.com

Twitter : @EmmanuelDemey

Matías Blasi

unread,
Aug 17, 2012, 4:23:02 PM8/17/12
to tapestry...@googlegroups.com
Thanks Emmanuel,

I have this problem in every ajax call.

The problem is because I am doing that in the filter before calling handler.service(...).

Anyway, by refreshing the zone which wraps jGrowl, is not enough for getting the messages... I would need to add every new message, for example through 'addjGrowlAlert'... I tryied to do that, using the ajaxResponseRenderer, but it has no effect calling it after the service handling...

I really don't know which would be the best way...

Regards,
Matías.

Matías Blasi

unread,
Aug 18, 2012, 11:52:29 AM8/18/12
to tapestry...@googlegroups.com
I solved it by advising my messageing service, and every time I add a message, I set an ajax callback in the AjaxResponseRenderer to add this new message through jGrowl (ony in ajax cases).

Thanks a lot!

Regards,
Matías.

Iván Sixto López

unread,
Jan 9, 2015, 7:36:21 AM1/9/15
to tapestry...@googlegroups.com
Could you please put an example? :S
Reply all
Reply to author
Forward
0 new messages