Hi

I'm currently using ui.datepicker on a page which uses event
delegation (via javascriptmvc) to hook up event handlers. When I click
a link on the datepicker, say "previous month", the inline event
handler is fired which rebuilds the datepicker html. The event then
bubbles up to the page delegation handler, which then attempts to
match it up to an appropriate handler. Unfortunately it's choking
because the target element no longer exists in the dom because the
rebuilt html has replaced it.

The best solution I can think of in this situation is to prevent the
event from bubbling up, so I have temporarily inserted the following
code in the datepicker onclick handler, after the call to _adjustDate:

if(event.stopPropagation) event.stopPropagation(); if
(event.preventDefault) event.preventDefault(); event.cancelBubble =
true; event.cancel = true; event.returnValue = false; return false;

This appears to resolve my issue. Now ideally, I would have an
extension point in the datepicker somewhere that I could hang this
off, without having to resort to maintaining a fork of the datepicker
code. I tried looking in the jquery.ui trac to see if there were any
other users with a similar issue, but trac appears to be down at the
moment. So in the meantime, I am going to assume that there is not and
try to patch datepicker myself. I'm going to add a config option which
is an optional callback function which, when supplied, will be called
from all onclick handlers, and which receives the event as an
argument.

Any comments/other ideas on this would be great.

Cheers
Lee

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to