Skip to main content

Search and Top Navigation

#5737 closed bug (notabug)

Opened June 17, 2010 08:24PM UTC

Closed October 11, 2012 05:39PM UTC

Last modified October 11, 2012 09:15PM UTC

Datepicker error when using Livequery

Reported by: dev@celect.org 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.

Attachments (0)
Change History (2)

Changed October 11, 2012 05:39PM UTC by scottgonzalez comment:1

resolution: → invalid
status: newclosed

This doesn't sound like a bug in datepicker.

Changed October 11, 2012 09:15PM UTC by scottgonzalez comment:2

milestone: TBD

Milestone TBD deleted