Jquery datepicker inline beforeshowday not working equal as popup

Jquery datepicker inline beforeshowday not working equal as popup

When I am using a datepicker as a popup I use the beforeShowDay method to disable some dates of it, and it works just fine. I have an array of busyDates filled before the datepicker initialization, and then I compare day by day to see if is or not on the busyDates array.

But if I atach the picker to a div (instead of an input) making it inline (always visible), the disabled dates are not shown as disabled until some interaction is done with the widget.

I am very positive there is some little thing I am missing here, but tried some ideas like firing the refresh or show methods after the initialization and nothing changed.

This is my code of the working popup datepicker attached to a input:

    var inputStartingDate = $("#inputStartingDate");
    inputStartingDate.datepicker({
        beforeShowDay:  function(date){
            var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
            return [jQuery.inArray(string, datesBusy) == -1];
        }
    });

And this is the NOT working inline datepicker attached to a div:

    var divMyCalendar = $("#divMyCalendar");
    divMyCalendar .datepicker({
       beforeShowDay:  function(date){
            var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
            return [jQuery.inArray(string, datesBusy) == -1];
        },         
     });

If for example I do this in the second case:

    var divMyCalendar = $("#divMyCalendar");
    divMyCalendar .datepicker({
       beforeShowDay:  function(date){
            return [0];
        },         
     });

All of a sudden it works fine, disabling the entire calendar. So It seems to be a problem with my array or something. Anyway I used the firefox debugger to put a stop at runtime at that point and I found the array and everything was working as expected but the datepicker didnt disabled the dates tough.

Thank you very much for time and uninterested consideration :)