Opened 13 years ago

Closed 10 years ago

Last modified 10 years ago

#5737 closed bug (notabug)

Datepicker error when using Livequery

Reported by: [email protected] Owned by:
Priority: major Milestone:
Component: ui.datepicker Version: 1.8.2
Keywords: Cc:
Blocked by: Blocking:

Description

In theory the following should work:

$(...).livequery(function () {

$(this).datepicker();

});

This should allow for dynamically generated calendar fields to be populated and bound with UI's Datepicker.

However, after long searching on the internet it appears you must do:

$(...).livequery(function () {

$(this).datepicker('destroy'); $(this).datepicker();

});

Which again, should work in theory [and appears to have in the past].

My current work around [and possible fix?] is to add another if statement to verify that inst is not null:

/* Detach a datepicker from its control.

@param target element - the target input field or division or span */

_destroyDatepicker: function(target) {

var $target = $(target); var inst = $.data(target, PROP_NAME); if (!$target.hasClass(this.markerClassName)) {

return;

} var nodeName = target.nodeName.toLowerCase(); $.removeData(target, PROP_NAME); if (nodeName == 'input') {

if (inst) {

inst.append.remove(); inst.trigger.remove();

} $target.removeClass(this.markerClassName). unbind('focus', this._showDatepicker). unbind('keydown', this._doKeyDown). unbind('keypress', this._doKeyPress). unbind('keyup', this._doKeyUp);

} else if (nodeName == 'div'
nodeName == 'span')

$target.removeClass(this.markerClassName).empty();

}

I'm using Jquery 1.4.2, Jquery UI 1.8.2 and Livequery 1.1.1.

Thank you.

Change History (2)

comment:1 Changed 10 years ago by Scott González

Resolution: invalid
Status: newclosed

This doesn't sound like a bug in datepicker.

comment:2 Changed 10 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.