• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

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

 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

 
Jignesh Gohel
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


 
Poop goes in a willow feeder. Wipe with this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic