Telerik's ASP.NET AJAX Calendar exposes rich client-side API set which allows easy and flexible use in a wide range of application scenarios.
In this example we demonstrate the main client-side functions:
-
selectDate(date, navigate) - Takes a triplet representation of a date, and if valid selects it in the calendar. The second boolean parameter denotes whether the calendar should navigate visually to the selected date. You have to use the true value as an input, if false is used the date will be selected but the calendar won't change its visual state.
-
selectDates(dates, navigate) - Takes an array of triplets representing dates and if valid selects them in the calendar. The second boolean parameter denotes whether the calendar should navigate visually to the selected date. One must use true value as an input, if false is used the date will be selected but the calendar won't change its visual state.
-
unselectDate(date) - Takes a triplet representation of a date and if valid deselects it in the calendar.
-
unselectDates(dates) - Takes an array of triplets representing dates and if valid deselects them in the calendar.
-
get_selectedDates( ) - Returns an array of date triplets, representing the selected dates contained in the calendar.
-
get_rangeMinDate( ) - Returns an array of date triplets, representing the RangeMinDate of the calendar.
-
set_rangeMinDate(date) - Takes an array of triplets representing the date and if valid set the RangeMinDate to it.
-
get_rangeMaxDate( ) - Returns an array of date triplets, representing the RangeMaxDate of the calendar.
-
set_rangeMaxDate(date) - Takes an array of triplets representing the date and if valid set the RangeMaxDate to it.
All client-side functions that take or return date values use a custom interchange format for transferring dates. The format (due to javascript's Date object regarding calendars different than Gregorian) is as follows: [2005, 11, 15]. This is a triplet array where the first position is the year, the second is the month and the third is the day.
The selected dates array returned by some functions is an array, where every cell of is a date representation triplet. This representation looks like this:
[ [2005, 11, 15], [2005, 11, 16], [2005, 11, 17] ]