Search and Top Navigation
#2481 closed bug (fixed)
Opened March 10, 2008 04:18PM UTC
Closed May 04, 2008 10:56AM UTC
Last modified February 26, 2009 11:59AM UTC
Inflexibility with UI Datepicker: still limited to ready event with bottom script approach
Reported by: | klaus | Owned by: | iMarc |
---|---|---|---|
Priority: | minor | Milestone: | 1.5 |
Component: | ui.core | Version: | 1.2.3 |
Keywords: | Cc: | klaus | |
Blocked by: | Blocking: |
Description
Due to the usage of the document ready event
/* Initialise the date picker. */ $(document).ready(function() { $.datepicker = new Datepicker(); // singleton instance $(document.body).append($.datepicker._datepickerDiv). mousedown($.datepicker._checkExternalClick); });
the datepicker becomes inflexible in its usage. Using a bottom script approach (instead of DOM ready) still requires the ready event to initialize a datepicker on the page to prevent an error ($.datepicker has no properties).
Quickfixed it by moving the datepicker initialization into the datepicker method itself, although I may have overlooked the impact of this:
$.fn.datepicker = function(options){ /* Initialise the date picker if necessary. */ if (!$.datepicker) { $.datepicker = new Datepicker(); // singleton instance $(document.body).append($.datepicker._datepickerDiv). mousedown($.datepicker._checkExternalClick); } var otherArgs = Array.prototype.slice.call(arguments, 1); ... };
Attachments (0)
Change History (7)
Changed March 10, 2008 04:19PM UTC by comment:1
summary: | Inflexibility with UI Datepicker: limited to window load event with bottom script approach → Inflexibility with UI Datepicker: still limited to ready event with bottom script approach |
---|
Changed March 10, 2008 04:20PM UTC by comment:2
cc: | → klaus |
---|
Changed March 11, 2008 10:06AM UTC by comment:3
owner: | paul → iMarc |
---|
Changed May 02, 2008 07:15PM UTC by comment:4
@Mark:
Klaus' recommend fix also resolves the issue I was having trying to use the $.datepicker() inside a div which has it's content loaded via AJAX. When the document.ready() method is used, errors are thrown. By initializing on first call, all issues are resolved.
-Dan
Changed May 04, 2008 10:56AM UTC by comment:5
resolution: | → fixed |
---|---|
status: | new → closed |
I think his should be fixed by moving the instance creation to the block before document.ready.
Changed May 24, 2008 03:39AM UTC by comment:6
milestone: | 1.2.4 |
---|
Milestone 1.2.4 deleted
Changed February 26, 2009 11:59AM UTC by comment:7
milestone: | → 1.5 |
---|