jQuery EasyUI Form Plugin - Calendar
jQuery EasyUI Plugins
Override the default defaults via $.fn.calendar.defaults.
The calendar displays a month view that allows users to select a date and move to the previous or next month. By default, the first day of the week is set to Sunday. This can be changed by setting the 'firstDay' property.
Usage
Create a calendar from markup.
Create a calendar using JavaScript.
$('#cc').calendar({
current:new Date()
});
property
| Name | Type | Description | Default value |
|---|---|---|---|
| width | number | The width of the calendar component. | 180 |
| height | number | The height of the calendar component. | 180 |
| fit | boolean | When set to true, the calendar is sized to fit its parent container. | false |
| border | boolean | Defines whether to show a border. | true |
| firstDay | number | Defines the first day of the week. Sunday is 0, Monday is 1, ... | 0 |
| weeks | array | The list of weekdays to display. | ['S','M','T','W','T','F','S'] |
| months | array | The list of months to display. | ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] |
| year | number | The year of the calendar. The following example demonstrates how to create a calendar with a specified year and month. |
Events
| Name | Parameters | Description |
|---|---|---|
| onSelect | date | Triggered when the user selects a date. |
代码实例:
$('#cc').calendar({ onSelect: function(date){ alert(date.getFullYear()+":"+(date.getMonth()+1)+":"+date.getDate()); } }); |
Method
| Name | Parameters | Description |
|---|---|---|
| options | none | Return the options object. |
| resize | none | Resize the calendar. |
| moveTo | date | Move the calendar to a specified date. |
代码实例:
$('#cc').calendar('moveTo', new Date(2012, 6, 1)); |
jQuery EasyUI Plugins