Search and Top Navigation
#4481 closed bug (wontfix)
Opened April 17, 2009 01:55PM UTC
Closed November 30, 2009 12:38AM UTC
Last modified May 16, 2010 03:24PM UTC
beforeShowDay breaks dialog when element is inline
Reported by: | dmfontz | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.8 |
Component: | ui.datepicker | Version: | 1.7.1 |
Keywords: | beforeShowDay,inline | Cc: | |
Blocked by: | Blocking: |
Description
Seems to be related to the time it takes the beforeShowDay to execute. Adding a time out is a workaround. I also changed the beforeShowDay function to just return true and it worked. However, when the function actually does some processing the dp will not render.
See example here: http://jsbin.com/owita/edit
See discussion here: http://groups.google.com/group/jquery-ui/t/533b660261d3458d
Attachments (0)
Change History (3)
Changed May 07, 2009 10:25AM UTC by comment:1
component: | ui.dialog → ui.datepicker |
---|---|
milestone: | TBD → 1.7.2 |
Changed May 07, 2009 01:30PM UTC by comment:2
milestone: | 1.7.2 → 1.8 |
---|
Changed November 30, 2009 12:38AM UTC by comment:3
resolution: | → wontfix |
---|---|
status: | new → closed |
The problem appears to be that the callback function cannot access the array of dates to exclude, probably because it is all declared within the $(function() {}) initialiser callback. If the array and callback function are moved outside of this it all works again:
$(function() { $("#datepickerthing").datepicker({ beforeShowDay: nationalDays, altField: '#actualDate', minDate:'-11M', maxDate: '+2M' }); }); var natDays = ["4/22/2009","4/23/2009","4/24/2009","4/25/2009","4/26/2009","5/27/2009","5/28/2009","6/26/2009","6/27/2009","6/28/2009","6/29/2009","6/30/2009"]; function nationalDays(date) { var sDate = (date.getMonth()+1).toString() + "/" + date.getDate().toString() + "/" + date.getFullYear().toString(); if ($.inArray(sDate, natDays) != -1) return [false,"","Not this day!"]; else return [true, ""]; }