#4528 closed enhancement (wontfix)
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 (5)
Changed 14 years ago by
Attachment: | ui.datepicker.highlight.patch added |
---|
comment:1 Changed 14 years ago by
Milestone: | TBD → 1.8 |
---|
Changed 14 years ago by
Attachment: | ui.datepicker.highlight_v2.patch added |
---|
comment:2 Changed 14 years ago by
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.
comment:3 Changed 14 years ago by
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.
Adds setHighlight method (proposal)