Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#4481 closed bug (wontfix)

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:


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:

See discussion here:

Change History (3)

comment:1 Changed 14 years ago by Jörn Zaefferer

Component: ui.dialogui.datepicker
Milestone: TBD1.7.2

comment:2 Changed 14 years ago by Jörn Zaefferer


comment:3 Changed 14 years ago by kbwood

Resolution: wontfix
Status: newclosed

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() {
    beforeShowDay: nationalDays,
    altField: '#actualDate', 
    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, ""];
Note: See TracTickets for help on using tickets.