Display Events in the Calendar
For displaying events in the Calendar widget you need a variable of type Array or an object with single event data. The data must contain a field corresponding to Start property, other properties are optional. The expected date format for the value of Start property is a Date Object – ‘YYYY/MM/DD’ or ‘MM/DD/YYYY’ or ‘DD MMMM YYYY’.
- Drag and drop a Calendar widget onto the canvas
- Bind the variable consisting the data to the Dataset Value property of the widget.
- Set the properties Title, Start, End, All day, Class name to the keys of the variable bound.
Note: Start property is a must, other properties are optional.
- Enable controls
There are five different types of controls on the calendar that can be enabled to:
- navigate between the months, weeks and days, depending on the calendar view
- select current day
- switch the view to Month
- switch the view to Week
- switch the view to Day.
Type can be:
- set as basic – will show the events in a single row, or
- set as Agenda – will show the complete day agenda with hours included.
Capturing Events in the Calendar
- currentview: gives the start and end values of the current calendar view
- selecteddata: gives the entire dataset corresponding to the selected item within the calendar
- selecteddates: gives the user selection on the calendar.
Configurations for Calendar
Calendar comes in three views – Month, Week and Day.
- The Month view of the Calendar displays all the days in the month.
- The Week view of the Calendar displays all the days in the week.
- The Day view of the Calendar displays all the events on the day.
|Name||The name is a unique identifier for the Calendar. Special characters and spaces are not allowed in widget name.|
|Tab index||The tab index attribute specifies the tab order of an element. You can use this property to change the default tabbing order for widget access using the tab key. The value can range from 0 to 32767. The default is 0 and -1 makes the element non-focusable.
NOTE: In Safari browsers, by default, Tab highlights only text fields. To enable Tab functionality, in Safari Browser from Preferences -> Advanced -> Accessibility set the option “Press Tab to highlight each item on a webpage”.
|Width||The width of your widget can be specified in em, pt, px or % (i.e 50px, 75%).|
|Height||The height of your widget can be specified in em, pt, px or % (i.e 50px, 75%).|
|Value||This is the default value to display value for an editor widget. Note that the display value is just what the user sees initially, and is not always the dataValue returned by the widget.|
|Value||Set this property to a variable to populate the list of values to display.|
|Title||Title for the Event, set from the Dataset fields.|
|Start||Start date or date time for the event, set from the Dataset fields.|
|End||End date or date time for the event, set from the Dataset fields.|
|All day||Whether it is an All day event or not|
|Class name||Display Class to be applied to that event.|
|Show||Showing determines whether or not a component is visible. It is a bindable property.|
|Load on Demand
(visible only when show property is bound to a variable)
|When this property is set and show property is bound, the initialization of the widget will be deferred till the widget becomes visible. This behavior improves the load time. Use this feature with caution, as it has a downside (as we will not be able to interact with the widget through script until the widget is initialized). When show property is not bound the widget will be initialized immediately.|
|Type||This property allows you to set the type of the calendar widget:
|Enable Controls||This property allows you to enable the header controls for calendar widget. These include
All these controls on the calendar are used to navigate between the months and switch the view to Month(or) Week (or) Day.
Note:- This property is shown only for the Web version of the Calendar.
|View||This property allows you to set the default view of the calendar widget:
|Selection Mode||This property can be used to control the user selection of the dates using a simple mouse drag operation. The values can be:
|On Select||This event is triggered when a user selects one or more dates.|
|On View Render||This event handler is triggered when the calendar view is changed.|
|On Event Drop||This event handler is triggered when dragging of an event in calendar stops and the event has moved to a different day/time.|
|On Event Resize||This event handler is triggered when resizing of the event in calendar stops and the event has changed in duration.|
|On Event Click||This event handler is triggered when an event is clicked in the calendar.|
|On Event Render||This event handler is triggered when an event is rendered.|
To set the properties of the calendar widget through the script, access the properties on the calendar as (consider the calendar with name ‘wmcalendar’)
Page.Widgets.wmcalendar.propertyname and change or assign the values accordingly.
- To set the first day of the month view [Default: 0 (Sunday)]:
Page.Widgets.wmcalendar.calendarOptions.calendar.firstDay = 0;
- To hide the all day slot of the agenda view [Default: true]:
- To set the text of the all-day slot in the agenda view [Default: ‘all-day’]:
Other properties which can be set using the similar methods:
For more information on Calendar, properties see here.
|allDaySlot||Determines if the title (“all-day”) slot is displayed at the top of the calendar. When false, all-day events will not be displayed in agenda views.|
|allDayText||The text for title (“all-day”) slot at the top of the calendar.|
|slotDuration||The frequency for displaying time slots. Default: ’00:30:00′ (30 minutes)|
|slotLabelFormat||Determines the time-text that will be displayed on the vertical axis of the agenda views. default: ‘h(:mm)a’ The default English value will produce times that look like “5pm” and “5:30pm”.|
|slotLabelInterval||Determines how often the time-axis is labeled with text displaying the date/time of slots.|
|snapDuration||If not specified, this value is automatically computed from slotDuration. With slotDuration’s default value of 30 minutes, this value will be 1 hour.|
|scrollTime||Determines how far down the scroll pane is initially scrolled down. default: ’06:00:00′ (6am). The user will be able to scroll upwards to see events before this time. If you want to prevent users from doing this, use the minTime option instead.|
|minTime||Determines the starting time that will be displayed, even when the scrollbars have been scrolled all the way up. default: “00:00:00” The default “00:00:00” means the start time will be at the very beginning of the day (midnight).|
|maxTime||Determines the end time (exclusively) that will be displayed, even when the scrollbars have been scrolled all the way down. default: “24:00:00” The default “24:00:00” means the end time will be at the very end of the day (midnight).|
|slotEventOverlap||Determines if timed events in agenda view should visually overlap. default: true. When set to true (the default), events will overlap each other. At the most half of each event will be obscured. When set to false, there will be absolutely no overlapping.|
|selectDate()||It highlights the default date given for the calendar.
It shows the calendar view to default date given for the calendar. For example, to go to a specific date – 1st Jan 2107
This method renders the present view (i.e. year view will be the same) for the specified month. For example: To view the February month.
This method renders the present view (i.e. year view will be the same) for the next month. For example: To view the next month
This method renders the present view (i.e. year view will be the same) for the prev month. For example: To view the prev month
This method renders the present view (i.e. month/week view will be the same) for the next year. For example: To view the next year
It renders the present view (i.e. month/week view will be the same ) for the previous year. For example: To view the previous year
|rerenderEvents()|| It rerenders the events from the dataset. For example, to get events on the calendar, we use:
- 3.1 Button
- 3.2 Button Group
- 3.3 Calendar
- 3.4 Checkbox
- 3.5 CheckboxSet
- 3.6 Chips
- 3.7 Color Picker
- 3.8 Currency
- 3.9 Date
- 3.10 Datetime
- 3.11 FileUpload
- 3.12 Number
- 3.13 Radioset
- 3.14 Rating
- 3.15 Select
- 3.16 Select Locale
- 3.17 Slider
- 3.18 Switch
- 3.19 Text
- 3.20 Textarea
- 3.21 Time
- 3.22 Toggle