Search
Calendar.viewChanged Event
See Also
 






Raised when the selected view is changed.

Namespace: MindFusion.Common.UI
File: Calendar.js

 Syntax

JavaScript  Copy Code

EventDispatcher viewChanged

 Event Data

The event handler method receives the following arguments:
sender
A TabControl instance, which is the source of the event. This object will be passed to the handler function as the first argument.
args
A SelectedItemChangedEventArgs instance, which contains event data. This object will be passed to the handler function as the second argument.

 Example

The following code creates a calendar and handles its viewChanged event to check if the view is changed to DayView:

JavaScript  Copy Code

var ui = MindFusion.UI;

var calendar = new ui.Calendar(document.querySelector("#cal"));
calendar.theme = "gray";
calendar.viewChanged.addEventListener(handleViewChanged);
calendar.render();

function handleViewChanged(sender, args)
{
    var dayView = new ui.DayView();

    //if the view has been changed to DayView
    if ( typeof args.newItem == typeof dayView )
    {
        //do something
    } 
}

 See Also