custom callback to disable specific dates in datepicker

custom callback to disable specific dates in datepicker

Hi, thanks in advance and sorry if this is redundant to other posts.

This calendar is dynamically set when an individual logs in.  I pass their jsMinDate, jsMaxDate, and an array of blackout dates called jsForbiddenDatesArray.

I am trying to disable those forbidden dates whenever the calendar refreshes. Here's what I think I want to do, but somehow it does not work.  Will anyone please advise?  I do not understand how to implement renderCallback.

  1.     $('#datepicker').datepicker({
  2.         beforeShowDay: $.datepicker.noWeekends, 
  3.         dateFormat: 'yy-mm-dd',
  4.         defaultDate: new Date(2011,1-1,5),
  5.         numberOfMonths: [1,4] ,
  6.         minDate: new Date(jsMinDate),
  7.         maxDate: new Date(jsMaxDate),
  8.         onSelect: function(dateText,inst) { receiveMove(dateText,chosenLetter); },
  9.         renderCallback:   function($td,thisDate) {
  10.                                      var arrLen = jsForbiddenDatesArray.length;
  11.                                      for (var x=0; x<arrLen; x++) {
  12.                                          if ( thisDate == jsForbiddenDatesArray[x]) {
  13.                                              $td.addClass('ui-datepicker-unselectable');
  14.                                              $td.addClass('ui-state-disabled');
  15.                                          }
  16.                                      }
  17.                                   }
  18.     } )