|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
jsf.ajax.addOnEvent() is not triggering events for <f:ajax>
>From what I understand of <f:ajax> and the events system for JSF2 ajax, it should trigger these events for any AJAX request sent to the server.
For instance, this script will change the mouse cursor to an hourglass when an AJAX event occurs, but while it works for manual calls to jsf.ajax.request() , it is not working for <f:ajax> events. Do I really need to specify the <f:ajax onevent="..." > on each tag in order to get this to work? That seems slightly off to me. Thoughts? Submit a bug? --Lincoln /** * *************************************** * Busy Status */ if (!window["busystatus"]) { var busystatus = {}; } busystatus.onStatusChange = function onStatusChange(data) { var status = data.status; alert("ajax event triggered") if (status === "begin") { // turn on busy indicator document.body.style.cursor = 'wait'; } else { // turn off busy indicator, on either "complete" or "success" document.body.style.cursor = 'default'; } }; jsf.ajax.addOnEvent(busystatus.onStatusChange);
|
|
|
|
Re: jsf.ajax.addOnEvent() is not triggering events for <f:ajax>Hey Lincoln -
Saw your comment on my blog as well. If you look at the code of that blog, you'll note that I'm using <f:ajax render="blah"> in my blog's example - and it's working fine. There's something else you're doing that's making it not work. Moreover, there's no significant clientside difference between jsf.ajax.request and f:ajax where events are concerned - they're going to hit the same codepath. So whatever's going on, it's unlikely to be related to the difference between the two call methods. Regardless, I'd still like to know what it is that's causing the event to not get raised - are you sure that the ajax request is actually being made? Jim On 9/10/09 12:54 AM, Lincoln Baxter, III wrote: > >From what I understand of <f:ajax> and the events system for JSF2 > ajax, it should trigger these events for any AJAX request sent to the > server. > > For instance, this script will change the mouse cursor to an hourglass > when an AJAX event occurs, but while it works for manual calls to > jsf.ajax.request() , it is not working for <f:ajax> events. > > Do I really need to specify the <f:ajax onevent="..." > on each tag in > order to get this to work? That seems slightly off to me. > > Thoughts? Submit a bug? > --Lincoln > > > /** > * *************************************** > * Busy Status > */ > if (!window["busystatus"]) { > var busystatus = {}; > } > > busystatus.onStatusChange = function onStatusChange(data) { > var status = data.status; > > alert("ajax event triggered") > if (status === "begin") { // turn on busy indicator > document.body.style.cursor = 'wait'; > } else { // turn off busy indicator, on either "complete" or "success" > document.body.style.cursor = 'default'; > } > }; > > jsf.ajax.addOnEvent(busystatus.onStatusChange); > > > > -- > *Lincoln Baxter, III* > Co-Founder of OcpSoft <http://ocpsoft.com> > Author of PrettyFaces <http://ocpsoft.com/prettyfaces> URL Rewriting for JSF > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
|
Re: jsf.ajax.addOnEvent() is not triggering events for <f:ajax>Ok. We agree on the expected behavior.
As to why its not working with f:ajax, I'm sure the request is occurring, since the page is updating, and the data is persisted. What can I look for to help narrow this down? Sent from my Verizon Wireless BlackBerry -----Original Message----- From: Jim Driscoll <Jim.Driscoll@...> Date: Thu, 10 Sep 2009 08:41:30 To: <dev@...> Subject: Re: jsf.ajax.addOnEvent() is not triggering events for <f:ajax> Hey Lincoln - Saw your comment on my blog as well. If you look at the code of that blog, you'll note that I'm using <f:ajax render="blah"> in my blog's example - and it's working fine. There's something else you're doing that's making it not work. Moreover, there's no significant clientside difference between jsf.ajax.request and f:ajax where events are concerned - they're going to hit the same codepath. So whatever's going on, it's unlikely to be related to the difference between the two call methods. Regardless, I'd still like to know what it is that's causing the event to not get raised - are you sure that the ajax request is actually being made? Jim On 9/10/09 12:54 AM, Lincoln Baxter, III wrote: > >From what I understand of <f:ajax> and the events system for JSF2 > ajax, it should trigger these events for any AJAX request sent to the > server. > > For instance, this script will change the mouse cursor to an hourglass > when an AJAX event occurs, but while it works for manual calls to > jsf.ajax.request() , it is not working for <f:ajax> events. > > Do I really need to specify the <f:ajax onevent="..." > on each tag in > order to get this to work? That seems slightly off to me. > > Thoughts? Submit a bug? > --Lincoln > > > /** > * *************************************** > * Busy Status > */ > if (!window["busystatus"]) { > var busystatus = {}; > } > > busystatus.onStatusChange = function onStatusChange(data) { > var status = data.status; > > alert("ajax event triggered") > if (status === "begin") { // turn on busy indicator > document.body.style.cursor = 'wait'; > } else { // turn off busy indicator, on either "complete" or "success" > document.body.style.cursor = 'default'; > } > }; > > jsf.ajax.addOnEvent(busystatus.onStatusChange); > > > > -- > *Lincoln Baxter, III* > Co-Founder of OcpSoft <http://ocpsoft.com> > Author of PrettyFaces <http://ocpsoft.com/prettyfaces> URL Rewriting for JSF > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
| Free embeddable forum powered by Nabble | Forum Help |