Search and Top Navigation
#4528 closed enhancement (wontfix)
Opened May 12, 2009 12:20PM UTC
Closed June 09, 2009 03:58AM UTC
Last modified January 17, 2010 06:11AM UTC
highlight specific dates in datepicker
Reported by: | mstepnicki | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.8 |
Component: | ui.datepicker | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I have to highlight some specific dates on given datepicker. I quickly hacked together additional setHighlight method. It's my first attempt in modifying jQuery UI, so probably I've made a lot of mistakes. For example, i don't know if ''oc()'' function is at all necessary.
What I'd like to see is the more generic ability to set individual class for each cell - I couldn't achieve this yet, and the patch just fixes my specific problem. It's just a proposal and is probably not feasible to be merged directly.
Patch attached below.
Attachments (2)
Change History (3)
Changed May 12, 2009 04:05PM UTC by comment:1
milestone: | TBD → 1.8 |
---|
Changed May 15, 2009 06:47AM UTC by comment:2
OK, so I've managed to implement it. I still don't know if ''oc()'' function is necessary, but the rest of the code seems well enough.
Usage:
jQuery("#datepicker").datepicker('setHighlight', { css_class_name1: [Array of Dates], css_class_name2: [Array of Dates] });
Example:
jQuery("#datepicker").datepicker('setHighlight', { blue: [new Date (2009,5,1), new Date(2009,5,2)], red: [new Date (2009,5,7), new Date(2009,5,12)] });
Of course css classes need to be defined somewhere in custom css file.
''ui.datepicker.highlight_v2.patch'' attached.
Changed June 09, 2009 03:58AM UTC by comment:3
resolution: | → wontfix |
---|---|
status: | new → closed |
You can already achieve this through the beforeShowDay setting. This is set to a function that is called for each date shown. It receives the date and returns an array where [0] is true if the date is selectable, false if not, [1] is one or more CSS classes to apply, [2] is an optional popup tooltip. See the noWeekends function in the plugin for an example.