How to refresh displayed date in CalendarExtender?

650 Views Asked by At

I've this code that changes the maximum date of a second Calendar Extender to 90 days after the date that has been defined in a first one and minimum to the same it has been selected on the first and it works right except for one thing.

            var cal2 = $find("calendar2");
            var fecha = cal._selectedDate;

            var date = fecha.getDate() + 90;
            var year = fecha.getFullYear();
            var month = fecha.getMonth();

            var todayDate = new Date(year, month, date);


            cal2._startDate = cal._selectedDate;
            cal2._selectedDate = fecha;
            cal2._switchMonth(fecha);
            cal2._endDate = todayDate;

Problem is that if I first seelct a date on cal, dates are properly shown in cal2, but I select one on cal again then cal2 doesn't display in the same month that cal, what's much worse it displays to select days that would be now impossible to select and in fact you can select them unless you go back first to month mode.

Any idea on how to "refresh" the behavior of the second CalendarExtender?

Thank you.

1

There are 1 best solutions below

2
VEga On

you can use this method.

Sys.Extended.UI.CalendarBehavior.prototype.refresh = function () {
        this._isOpen = true;
        this._ensureCalendar();
        this.invalidate();
        this._isOpen = false;
    }
When you add the method only call:
cal2.refresh()