| |
Datepicker
Page history last edited by kbwood 4 mos ago
type: widget
release: 0.0
status: in planning
demo/documentation: http://jqueryui.com/demos/datepicker/
refactor branch demo: http://jquery-ui.googlecode.com/svn/branches/labs/datepicker/demos/index.html#datepicker|default
1 - Description:
This is a brand new planning page to discuss the code re-factor of the current datepicker plugin:
http://jqueryui.com/demos/datepicker/
To have a fresh start on the planning on this re-factor, the older wiki page that covered current and future datepicker and calendar ideas is archived here: DatePickerCalendar
The specific code and functionality changes we want to address in this refactor are:
-
Add the ability to customize the buttons in the bottom button bar. This would allow users to add a "clear form" button, shortcuts like "today" or "next delivery date". This would be similar to the dialog widget. I'd imagine it would looks something like this:
$('.selector').datepicker({
buttons: {
'clear': function(event, ui){
$(this).val('');
}
}
});
-
Improve datepicker positioning/z-index issues in dialogs and overlays, especially in IE
-
Re-factor the code to better match the jQuery UI API - a version is now available at http://github.com/kbwood/jquery-ui.
Sampling of feature requests that we might want to consider adding or accomodating as an extension to core picker:
-
Show week numbers - worth including?
-
Select multiple days on a calendar
-
Select a range on a calendar
-
Disable list of specific dates or days of the week
-
Highlightlist of specific or days of the week (maybe with an optional custom class)
-
Assign custom events to days (use case: inline datepicker with tooltips on days)
-
Allow datepicker to show on hover or allow this to be customised in the showOn option to accept any event.
- Add time selection.
2 - Visual Design:
3 - Functional Specifications/Requirements:
Options:
- showOnFocus (Boolean, default: true)
- When true a popup datepicker appears when the input field gains focus, when false showTrigger should be used instead.
- showTrigger (string or element or jQuery, default: null)
- An external element that triggers a popup datepicker for an input field. It can be either a jQuery selector, an HTML fragment, the actual element, or a jQuery collection containing the element. The given element is cloned for each input field and is placed after/before the field depending on the prevailing language direction.
- showAnim (string, default: 'show')
- The name of the animation to use when opening/closing a popup datepicker. It can be one of the built-in animations ('show', 'fadeIn', 'slideDown') or any of the jQuery UI animations. Use '' for no animation, just an immediate show/hide. (Is there a better way of describing an animation as an object, rather than using this and the following options to control different bits of it?)
- showOptions (object, default: {})
- Any additional options for a jQuery UI animation, e.g. change 'clip' to run horizontally: {direction: 'horizontal'}.
- showSpeed (number or string, default: 'normal')
- The speed at which the opening/closing animation plays. It can be either the name of a standard speed ('slow', 'normal', 'fast') or the duration in milliseconds.
- popupContainer (string or element or jQuery, default: null)
- The container to which the popup datepicker is appended.It can be either a jQuery selector, the actual element, or a jQuery collection containing the element. If not specified 'body' is used. This allows the datepicker to be repositioned within the DOM to allow for custom handling or styling.
- myPosition (string, default: '')
- The position of the popup datepicker division relative to its input field (using position plugin values). If not specified 'left top' or 'right top' is used depending on the language direction.
- atPosition (string, default: '')
- The anchor point of the popup datepicker on its input field (using position plugin values). If not specified 'left bottom' or 'right bottom' is used depending on the language direction.
- fixedWeeks (Boolean, default: false)
- When true six weeks are always shown in the datepicker. When false only the actual number of weeks required for the current month are shown.
- monthsToShow (number or number[2], default: 1)
- The number of months to show at the one time. It is either the number of columns, or the number of rows and columns (as an array).
- monthsOffset (number, default: 0)
- The offset from its normal position for the current month. For example, a value of 1 would place the current month in the second position and show the previous month in the first position.
- monthsToStep (number, default: 1)
- The number of months to move each time the previous/next month is requested.
- monthsToJump (number, default: 12)
- The number of months to move each time the previous/next year is requested.
- changeMonth (Boolean, default: false)
- When true the month and year can be changed directly via drop-down lists. When false the month and year are displayed only and changes must be made with the previous/next buttons.
- yearRange (string, default: 'c-10:c+10')
- The range of years to show in the year drop-down for user selection. It consists of the start and end values separated by a colon (:), with each value being one of '+/-nn' for an offset from today's year, 'c+/-nn' for an offset from the first currently selected date (or today if none), 'nnnn' for an absolute year. For example, '1980:-10' indicates a range from 1980 to 10 years before today. Use a special value of 'any' to allow direct entry of the year instead of selection from a drop-down. Note that this option only affects the year drop-down list and that minDate/maxDate must be used to restrict the range of dates that may be selected.
- shortYearCutoff (number or string, default: '+10')
- When the short year format is used, this option determines which century is applied to the date. If a number (0-99) is given it is used directly. If a string is given it is added to the current year within the century. Then any partial year greater than the derived value is deemed to be in the previous century. Use a value of -1 to disable this feature and always use 1900.
- showOtherMonths (Boolean, default: false)
- When true days from other months that precede or follow the current month are shown in the datepicker. When false these days do not appear.
- selectOtherMonths (Boolean, default: false)
- When true (and showOtherMonths is also true) the dates from other months that precede or follow the current month are able to be selected. When false these dates are display only.
- defaultDate (Date or string or number, default: null)
- The date to highlight when no other date has been selected in the datepicker. It is either an actual Date object, a string with the date in the current dateFormat, a number of days offset from today, or a string of units and periods offset from today - using 'y' for years, 'm' for months, 'w' for weeks, 'd' for days, e.g. '+1m -1d'. If not specified today is used.
- selectDefaultDate (Boolean, default: false)
- When true and no other date has been selected the defaultDate is automatically selected as the field value.
- minDate (Date or string or number, default: null)
- The minimum date allowed to be selected in the datepicker. It is either an actual Date object, a string with the date in the current dateFormat, a number of days offset from today, or a string of units and periods offset from today - using 'y' for years, 'm' for months, 'w' for weeks, 'd' for days, e.g. '+1m -1d'. If not specified there is no minimum.
- maxDate (Date or string or number, default: null)
- The maximum date allowed to be selected in the datepicker. It is either an actual Date object, a string with the date in the current dateFormat, a number of days offset from today, or a string of units and periods offset from today - using 'y' for years, 'm' for months, 'w' for weeks, 'd' for days, e.g. '+1m -1d'. If not specified there is no maximum.
- autoSize (Boolean, default: falsel)
- When true the input field is automatically resized to fit a date in the current dateFormat. When false the input field's size is unchanged.
- altField (string or element or jQuery, default: null)
- A reference to another field that is maintained in synch with the datepicker selections. It can be either a jQuery selector, the actual element, or a jQuery collection containing the element.
- altFormat (string, default: null)
- The dateFormat to apply to the altField. This allows the selected date to be shown in one format to the user while maintaining a second format more suited for internal processing.
- constrainInput (Boolean, default: true)
- When true keystrokes in the input field are constrained to those accepted by the dateFormat. When false any keystroke is accepted.
Localisation:
- monthNames (string[12], default: ['January', ...])
- The full names of the months.
- monthNamesShort (string[12], default: ['Jan', ...])
- The abbreviated names of the months.
- dayNames (string[7], default: ['Sunday', ...])
- The full names of the days of the week starting from Sunday.
- dayNamesShort (string[7], default: ['Sun', ...])
- The abbreviated names of the days of the week starting from Sunday.
- dayNamesMin (string[7], default: ['Su', ...])
- The minimal names of the days of the week starting from Sunday.
- firstDay (number, default: 0)
- The index of the first day of the week: 0 is Sunday, 1 is Monday, ...
- dateFormat (string, default: 'mm/dd/yyyy')
- The format for the date that appears in the input field. Use 'd' for day of the month, 'dd' for day of the month two digits, 'o' for day of the year, 'oo' for day of the year three digits, 'D' for day of the week abbreviated, 'DD' for day of the week full, 'm' for month, 'mm' for month two digits, 'M' for month name abbreviated, 'MM' for month name full, 'yy' for year two digits (see shortYearCutoff), 'yyyy' for year four digits, '@' for Unix timestamp, '!' for Windows ticks, other characters as literals. Quote (') reserved characters to prevent their substitution.
- isRTL (Boolean, default: false)
- When true the language runs right-to-left. When false it runs left-to-right.
Methods:
- .datepicker('enable')
- Enable the datepicker field and any associated trigger.
- Returns the jQuery object.
- .datepicker('disable')
- Disable the datepicker field and any associated trigger.
- Returns the jQuery object.
- .datepicker('isDisabled')
- Determine whether or not a datepicker is disabled.
- Returns true if the first entry in the list has its datepicker disabled, false if not.
- .datepicker('getDate')
- Retrieve the currently selected date.
- Returns the selected date or null if none selected.
- .datepicker('setDate', date)
- Alter the currently selected date.
- date (Date) is the new selected date, or null to clear it.
- Returns the jQuery object.
- .datepicker('show')
- Popup the datepicker for an input field.
- Returns the jQuery object.
- .datepicker('hide')
- Hide the current popup datepicker.
- Returns the jQuery object.
- .datepicker('showMonth', year, month, [day])
- Set the datepicker to show the given year and month.
- year (number) is the new year to show.
- month (number) is the new month to show (1-12).
- day (number, optional) is the day within this month to highlight initially.
- Returns the jQuery object.
- .datepicker('changeMonth', offset)
- Move the datepicker to show a new month relative to the current one.
- offset (number) is the number of months to move.
- Returns the jQuery object.
- .datepicker('changeDay', offset)
- Move the cursor date by a number of days, showing a new month/year if necessary.
- offset (number) is the number of days to move.
- Returns the jQuery object.
Events:
- onDate
- Called for each date as it is added to the datepicker, allowing that date's appearance/behaviour to be customised.
- Accepts the date as a parameter.
- Returns an object with (all optional) attributes: selectable (Boolean) true if this date is selectable, false if not, dateClass (string) any CSS classes to apply to the date, title (string) popup tooltip for the date, content (string) customised content to replace the default day-of-the-month number.
- onShow
- Called after the datepicker has been constructed but before display, allowing the datepicker's appearance/behaviour to be customised.
- Accepts the datepicker div and current instance settings as parameters.
- May update the provided div.
- Returns nothing.
- changeMonthYear
- Called when the datepicker displays a new month/year, e.g. when previous/next buttons are clicked.
- Accepts the new date (first of the new month) as a parameter.
- Returns nothing.
- select
- Called when a date is selected or cleared.
- Accepts the new date (or null if cleared) as a parameter.
- Returns nothing.
- close
- Called when a popup datepicker is closed (with or without selection).
- Accepts the currently selected date (or null if none) as a parameter.
- Returns nothing.
4 - Markup & Style:
4.1 Initial markup examples
<input type="text" name="myDatepicker">
<input type="date" name="myDatepicker" min="1970-01-01" max="2020-12-31" value="2009-05-22">
4.2 Recommended transformed HTML markup
(The HTML markup structure and classes that will be used by the scripts in the enhanced version)
4.3 Accessibility recommendation
(Detailed recommendations for ARIA, HTML markup, CSS and javascript that will contribute to universal access and full section 508 accessibility for screen readers, mobile devices and any other devices)
Issues with current datepicker:
- focus is indicated using color alone
- the next/prev month icons are invisble in high contrast mode, not indication of focused day is available.
- thecontrols/links in the date picker do not recieve programmtaic focus.
- table caption not explictly associated.
- Expansions for day abbreviations not provided
4.4 CSS & Theme
(Description of the CSS classes to be used for all states, how custom theming and Themeroller support will work.)
5 - Latest version of plugin:
http://jquery-ui.googlecode.com/svn/trunk/demos/datepicker/index.html
Refactor to jQuery UI widget available at http://github.com/kbwood/jquery-ui.
6 - Open issues being discussed
- What's the best way to deal with backwards compatibility? Should this be built-in for now as deprecated code for removal in 1.next + 1? Or should we provide a compatibility script which means by default if a user upgrades their existing code will break unless they also add this compatility script.
- Should the datepicker support any DOM element?
Datepicker
|
|
Tip: To turn text into a link, highlight the text, then click on a page or file from the list above.
|
|
|
|
|
Comments (Show all 56)
JasonReed said
at 3:51 pm on May 13, 2009
I agree completely- then again, that was my ticket so nor surprise there. :)
Dan said
at 8:51 am on May 18, 2009
I'm not sure if this has already been covered in the CSS changes but I've noticed some problems in IE 6 and 7...
1. The hover state only works while hovering over the anchor text for the date not the entire td element.
2. When using the changeMonth and changeYear options, the width is not calculating correctly causing the left and right floats to "overlap".
Dan said
at 9:02 am on May 18, 2009
It seems the 2nd issue is being caused because the containing div (ui-datepicker-title) does not have a width set which would allow the floated selects to get their percentages...
Dan said
at 11:58 am on May 18, 2009
Ok, a proper DTD fixes the 2nd issue but it should probably work in quirks mode too.
shamun toha said
at 2:16 pm on May 18, 2009
#Feature suggest:
1. Better the width, height of the date picker or putting a zoom in or out parameter.
example of problem issues screen shot:
http://picasaweb.google.com/lh/photo/eAuHtoMdDCHjIMbjZlGOfA?feat=directlink
Ca-Phun Ung said
at 4:30 am on May 22, 2009
Looks odd. Could you add a ticket to our bug tracker with a minimal test page? Thanks!
David Rodriguez said
at 7:44 am on May 21, 2009
I'd like to be able to separate the month day and years into three different input fields but use the datepicker to update all three inputs at the same time.
kbwood said
at 8:44 pm on May 23, 2009
See an example on the original datepicker at http://keith-wood.name/datepick.html#misc. The same should be possible with the current UI datepicker.
kbwood said
at 8:50 pm on May 23, 2009
For backwards compatibility I would prefer a separate compatibility script. This would remove unnecessary code from the head version and would encourage users to migrate. Of course, there would have to be ample warnings and documentation to inform people of the differences and ease their upgrade path.
For other DOM elements, what is the purpose of attaching the datepicker to other than an input field, a division or span?
John Worrall said
at 5:28 pm on Jun 10, 2009
Would it be possible to add to the DatePicker the ability to select Time as well?
Ca-Phun Ung said
at 1:54 am on Jun 11, 2009
I think this could be implemented as a combo widget. There is a time picker planned and the spinner may also support time. So in theory you could have both the datepicker and spinner acting upon the same input element to enhance functionality.
Ca-Phun Ung said
at 1:51 am on Jun 11, 2009
Some recent feedback about needing datepicker improvements:
http://groups.google.com/group/jquery-ui/browse_thread/thread/afe5816aaf1bd19d
Apart from complaints about needing more tuts and demos, which we know is lacking, I think the jist of the above discussion is:
* Should we change the formatDate option so it's more inline with PHP's Date function
* Should we make the callback parameters more consistent? i.e. onSelect and onClose has dateText (string) but beforeShowDay has date (date object)
Jörn Zaefferer said
at 5:02 am on Jul 8, 2009
This depends on Marc calendar engine, right?
Scott González said
at 7:09 am on Jul 8, 2009
That's the plan. Here's the code: http://github.com/1Marc/calendar-engine/tree/master
Ca-Phun Ung said
at 7:56 am on Jul 8, 2009
Sorry for my ignorance but I did not realise the plan would be to use Marc's calendar engine. Could we document this?
Ca-Phun Ung said
at 6:21 am on Jul 14, 2009
So I don't waste my limited time could we please be more specific on what the plan is? If we use Marc's calendar engine could I deduce that we won't be needing much of the existing datepicker code, hence better to start from scratch rather than refactoring?
Scott González said
at 7:10 am on Jul 14, 2009
The plan is to review Marc's calendar engine to see if we want to use it (my guess is yes, since he specifically wrote it to address all of the issues of our current datepicker). If I was working on this, I'd be starting from scratch.
Chiefs said
at 1:15 pm on Jul 15, 2009
I really like that widget. Question for u: how can I call t popup from a div, a link etc. let's say "Choose Date" or something. Do I always need to call it from input type="date"?
Blaz said
at 2:31 am on Aug 4, 2009
Most of the users with more experiences probably already know this but
others can have problems when implementing datepicker to ASP.NET
controls, for example textbox (especially if they are inside other
control - web form, repeater).
This is a solution somebody posted on asp.net forums:
1.) "Change the TextBox's CssClass property to "dateTextBox". Then,
use exactly this JavaScript (remove the other inline script in that
area so there are no extraneous errors):"
1.) (inside web form, control, etc.)
<script type="text/javascript">
$(document).ready(function() {
$('.dateTextBox').datepicker();
});
</script>
2.) if you do not have web control. You also don't need the css.
<script type="text/javascript">
$(function ()
{$('#date').datepicker();}
);
</script>
also you must have in masterpage the following code:
<link type="text/css" href="../CSS/jquery-
ui-1.7.2.calendar.css"rel="stylesheet" />
<script type="text/javascript" src="../JS/jquery-1.3.2.min.js" ></
script>
<script type="text/javascript" src="../JS/jquery-
ui-1.7.2.custom.min.js"></script>
<script type="text/javascript">
$(function(){
// Datepicker
$('#datepicker').datepicker({
inline: true
});
//hover states on the static widgets
$('#dialog_link, ul#icons li').hover(
function() { $(this).addClass('ui-state-hover'); },
function() { $(this).removeClass('ui-state-hover'); }
);
});
</script>
There can be better options to do this. Also you must notice that this
don't work in IE ("appearing" effect) as same as is working if you
have input type on page without any controls.
Any additional comments are welcome.
Jörn Zaefferer said
at 1:32 pm on Sep 1, 2009
Of the options on the current datepicker, appendText is a good candidate to be dropped. It specifies the text to append after the input element. That is really easy enough do to with regular jQuery methods and outside the scope of the datepicker plugin.
Jörn Zaefferer said
at 1:39 pm on Sep 1, 2009
The showOn, buttonText, buttonImage, and buttonImageOnly options could be refactored. Instead of exposing all these options, let the user create the input and pass that along for binding a click event; or open the datepicker on focus of the input by default, and let the user specify other events to open the picker, via datepicker("open").
Jörn Zaefferer said
at 1:41 pm on Sep 1, 2009
The animation-options are odd at best. You have to set duration to an empty string (or any falsy? not sure) to disable animations. Then there is also showAnim and showOptions...
Jörn Zaefferer said
at 1:42 pm on Sep 1, 2009
numberOfMonths, stepMonths and showCurrentAtPos are certainly useful, but the names don't suggest any relation between those, while they are actually closely related.
Jörn Zaefferer said
at 1:50 pm on Sep 1, 2009
The altField option can be easily implemented using the select-callback.
Jörn Zaefferer said
at 1:54 pm on Sep 1, 2009
onChangeMonthYear, onSelect and onClose need renaming.
Jörn Zaefferer said
at 1:58 pm on Sep 1, 2009
The isDisabled method needs to be replaced with option-disabled. enable/disable methods, too.
get/setDate should be merged into one method.
show/hide could be renamed to open/close, to be more consistent with dialog.
The dalog-method is odd...
Jörn Zaefferer said
at 1:59 pm on Sep 1, 2009
The beforeShow API is, well, odd. Returning arrays with two elements??
Jaggi said
at 9:48 am on Sep 2, 2009
i'd like to see some access to some of datepickers date functions. This came about when i needed to do something with max date. I had to do it manually in the end but basically what i did was have a start date and end date (range) and i set the minDate of end date to the value returned by start date by doing ($('#startDate').datepicker('getDate') ) then i needed to set the maxDate of the end date to two months in the future of minDate. There was no easy way to do this with jquery so had to create a function to do using the date modifiers but we can change the date pretty easily on maxDate by doing maxDate: '+2'; what i'd like to be able to do is something that would support something like:
maxDate: $('#startDate').datepicker('getDate')+ '+1m'; (this isn't actually a proper way it should or can work i'm just trying to show it in laymens terms).
it might be done by being able to access one of datepickers actual functions that works it out and have the ability to set the date to start from but i think it'd be useful all the same. What i actually discovered here however i would consider a bug to be honest, maxDate works out the date based off todays date but doesn't take into account values set by minDate/defaultDate which i think it should as we're kinda already telling you where to take the date from.
Jörn Zaefferer said
at 1:43 pm on Sep 2, 2009
This should be trivial with Marc's calendar engine. I'll ping Marc about it.
aurelien gerits said
at 8:46 am on Sep 30, 2009
Hello, after building a site into several languages.
I found that using $. Datepicker.setDefaults ($. Datepicker.regional ['en']); dynamic does not work very well with the "fr".
The locale does not work with English.
Example in PHP:
if ($ lang == 'en') (
print '$.datepicker.regional [ "en"]';
) elseif ($ lang == 'fr') (
print '$.datepicker.regional [ "fr"]';
)
My files for english params :
/* English initialisation for the jQuery UI date picker plugin. */
/* Written by Gerits Aurelien. (gerits point aurelien at gmail point com)*/
jQuery(function($){
$.datepicker.regional['en'] = {
closeText: 'Done', // Display text for close link
prevText: 'Prev', // Display text for previous month link
nextText: 'Next', // Display text for next month link
currentText: 'Today', // Display text for current month link
monthNames: ['January','February','March','April','May','June',
'July','August','September','October','November','December'], // Names of months for drop-down and formatting
monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
dateFormat: 'mm/dd/yy', // See format options on parseDate
firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
isRTL: false // True if right-to-left language, false if left-to-right
};
$.datepicker.setDefaults($.datepicker.regional['en']);
});
David Petersen said
at 6:11 pm on Feb 27, 2010
I have made a lot of progress in refactoring the datepicker code. Got it using the widget factory and Marc's calendar. Will post the code after the switch to github, (gives me more time to clean up the code)
One question I had while working through that code was, is datepicker('dialog') really necessary? Doesn't that option just create glorified inline datepicker that is absolute positioned on the screen? Seems like with the new position plugin there is no need to support this as an option of the datepicker. It could easily be handled by doing this:
$('#inl2').datepicker({
select: function(){
// do something with the selected date then hide it
$(this).hide();
}
}).position({my:'center', at:'center', of:window});
Is it worth the extra code needed to support it as an option when it is so easy to do it outside the plugin, also considering how little use this option really gets?
Scott González said
at 8:47 pm on Feb 27, 2010
Hey David,
As a general rule you should leave out everything that's not needed by 90% of the users. I'd start with the essentials and then we can figure out which options we want built in, which options should be built as extensions and which options should be left out.
kbwood said
at 2:14 am on Mar 7, 2010
I've done a refactor of the datepicker to conform to the current widget standard. It's available for review at https://jquery-ui.googlecode.com/svn/branches/labs/datepicker2.
As well as converting it to a widget, I've added the following:
* a templating ability to allow the end-user more control over the appearance of the datepicker,
* a command structure to allow end-users to add/change command buttons on the datepicker,
* common date routines for general use,
* use of the position plugin for placement,
* an extension module (jquery.ui.datepicker.ext.js) with less common usage requirements.
Please have a look through the demos and comment...
Richard D. Worth said
at 2:57 am on Mar 25, 2010
Hey Keith. Thanks for what you've done and for sharing it. It would be great if you could document some specifics on the points above so each person that might look into these changes doesn't have to figure them out through the implementation. Not full on documentation, but just what your design and thinking is. We need to be able to discuss this at a high-level design and spec level separate from implementation, and that's hard to do with bullet points, and can't be done by reverse engineering a sample implementation. Some questions that come to mind that may help you provide more detail:
* are you using a templating engine? have you looked at jQuery's which is in dev at http://github.com/jquery/jquery-tmpl and being discussed at http://forum.jquery.com/topic/jquery-templates-proposal . Also, what about using hooks with overridable functions for different parts of the control?
* shouldn't buttons be part of the templating? Or what about just a button pane that the user appends buttons to with jQuery? What is this command structure and why is it needed? jQuery is really good at manipulating dom elements and we don't want to re-build that into each widget's api for specific types of elements. Containers, hooks, and events go a long way.
* have these common date routines been abstracted into a low-level, reusable library? Is there any documentation? Is it jQuery-specific, library-agnostic? Are there other libraries like this? Does this one do more/less? Is it better? What does it do and decidedly not do? Is it extensible? Does it need to be?
Richard D. Worth said
at 2:57 am on Mar 25, 2010
* yeah for position :)
* widget extensions are cool but not if they're done in a widget-specific way. That is, we don't want the datepicker building in a widget extension mechanism because all widgets have a need to be extensible, and that should be done in common and standards ways. If you have found some success or challenges in this area, we'd love to hear about them and discuss them. Also, in order to discuss some less common usage requirements, we need to nail down what are the most common usage requirements, and more than that what should be built in (and how) for meeting those requirements. That's what this page is all about at the moment. So refactors and sample implementations are great, if they're an aid in that discussion.
Thanks for providing any and all details you can. That will go a long way in helping others appreciate and evaluate the work you've done and how it might be used. If this comment thread doesn't fit it all, please do a blog post or start a discussion thread on the Developing jQuery UI Forum and link to from here.
Also, I'm not able to view a bunch of the demos at the url above because the svn:mime-type isn't set on about half the files. Thanks.
Richard D. Worth said
at 3:10 am on Mar 25, 2010
Ok, we've got our existing widget and it looks like two refactors (David's and Keith's). As Scott pointed out above (Feb 27), let's get down to the fundamentals. So instead of worrying about refactoring and backwards-compatibility at this point, let's nail down the absolute minimum basic specs and features for a jQuery UI Datepicker and how it should be powered (Marc's engine, Keith's, some other?) and built (divs, tables, templates, buttons). That means fleshing out sections 3 and 4 above. The work that's been done on refactors, just as the existing component and its usage, will be an aid in this work and discussion, but we need to start the design from a zero base. Thanks everyone.
Jörn Zaefferer said
at 10:52 am on Apr 7, 2010
I've added a placeholder for the functional spec. Hopefully enough for getting you started.
Motty said
at 10:11 am on Jun 4, 2010
I would like an alternate layout like AnyTime (http://www.ama3.com/anytime/)... it's more user friendly I think and saves me from clicking like mad (or even typing LOL) to get to another year.
Met00 said
at 4:44 pm on Jul 21, 2010
"Improve datepicker positioning/z-index issues in dialogs and overlaysImprove datepicker positioning/z-index issues in dialogs and overlays"
Solution:
$(function() {
$.maxZIndex = $.fn.maxZIndex = function(opt) {
/// <summary>
/// Returns the max zOrder in the document (no parameter)
/// Sets max zOrder by passing a non-zero number
/// which gets added to the highest zOrder.
/// </summary>
/// <param name="opt" type="object">
/// inc: increment value,
/// group: selector for zIndex elements to find max for
/// </param>
/// <returns type="jQuery" />
var def = { inc: 10, group: "*" };
$.extend(def, opt);
var zmax = 0;
$(def.group).each(function() {
var cur = parseInt($(this).css('z-index'));
zmax = cur > zmax ? cur : zmax;
});
if (!this.jquery)
return zmax;
return this.each(function() {
zmax += def.inc;
$(this).css("z-index", zmax);
});
}
$("#datepicker").datepicker({ showButtonPanel: true,
beforeShow: function() {$('#ui-datepicker-div').maxZIndex(); },
dateFormat: 'yy/mm/dd' });
Met00 said
at 6:19 pm on Jul 21, 2010
View it in action here: http://www.wwinfo.com/images/admindesktop-datepicker.png
The page uses
1) jquery UI layout (http://layout.jquery-dev.net/documentation.cfm)
2) jquery datatables (http://datatables.net/)
3) jquery.ui dialog and the datepicker on top of the dialog
You don't have permission to comment on this page.