aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes DWR callback updating dom elements, jquery ui datepicker attached to updated element not showing up Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "DWR callback updating dom elements, jquery ui datepicker attached to updated element not showing up" Watch "DWR callback updating dom elements, jquery ui datepicker attached to updated element not showing up" New topic
Author

DWR callback updating dom elements, jquery ui datepicker attached to updated element not showing up

Jignesh Gohel
Ranch Hand

Joined: Dec 28, 2004
Posts: 276
Hi,

I have a search form on which I have the following INPUT field



When this search form is accessed I can see the date picker attached to the input#pickUpDate element when I click on it.

I submit this search form using DWR by invoking the search(...) function (shown below).

I reset the HTML body element's data with the response I receive. In the response received, I have a similar search form which contains the same input element (input#pickUpDate).However after I reset the body element's data using



in the DWR callback function and try to attach datepicker it does not work.I inspected that the element is appended the datepicker's "hasDatepicker" marker class name but still on focusing/clicking on the input field I cannot see the datepicker.

Following is my jQuery code :



I have gone through all the relevant posts I could find regarding this but the solutions mentioned in them didn't worked for me.

I am in need to know what is the causing the mentioned problem and how to get this resolved?


Regards,
Jignesh

The Art Of Life Is To Know When To Be Useless And When To Be Useful - CHUANG TZU
Jignesh Gohel
Ranch Hand

Joined: Dec 28, 2004
Posts: 276
Hi,

I have got this resolved.And posting my solution here for reference:



As per what I understood this is the explanation behind what was causing the problem

Before the AJAX call it's value was was set to true by the following block in source code of jquery.ui.datepicker.js (this block can be found near the end of the file)

Code:



Since the $.datepicker.initialized value was always found "true" after the HTML was updated on the page by DWR, the presentation div referred to by $.datepicker.dpDiv in jquery.ui.datepicker.js source code was not getting appended to the tag when datepicker() was invoked on an element which was causing the datepicker for not getting displayed though the marker class 'hasDatepicker' was getting applied.


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DWR callback updating dom elements, jquery ui datepicker attached to updated element not showing up