码迷,mamicode.com
首页 > 其他好文 > 详细

Calendar( 日历)

时间:2015-12-02 10:32:08      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:

本节课重点了解 EasyUI 中 Canlendar(日历)组件的使用方法,这个组件不依赖于其
他组件。
一. 加载方式
//class 加载方式
<div id="box" class="easyui-calendar"
style="width:200px;height:200px;"></div>
//JS 加载调用
$(‘#box‘).calendar({
});

 

二.属性列表

技术分享

技术分享

//属性设置
$(‘#box‘).calendar({
width : 200,
height : 200,
fit : false,
border : false,
firstDay : 0,
weeks : [‘S‘,‘M‘,‘T‘,‘W‘,‘T‘,‘F‘,‘S‘],
months : [‘Jan‘, ‘Feb‘, ‘Mar‘, ‘Apr‘, ‘May‘, ‘Jun‘, ‘Jul‘, ‘Aug‘,
‘Sep‘, ‘Oct‘, ‘Nov‘, ‘Dec‘],
year : 2012,
month : 6,
current : new Date(2014,7,1),
formatter : function (date) {
return ‘#‘ + date.getDate();
},
styler : function (date) {
if (date.getDay() == 1) {
return ‘background-color:#ccc‘;
}
},
validator : function (date) {
if (date.getDay() == 1) {
return true;
} else {
return false;
}
},
});

 

 

三.事件列表

技术分享

//事件列表
$(‘#box‘).calendar({
onSelect : function (date) {
alert(date.getFullYear() + ":" + (date.getMonth() + 1) + ":"
+ date.getDate());
},


onChange : function (newDate, oldDate) {
alert(newDate + ‘|‘ + oldDate);
},
});

 

 

四.方法列表

技术分享

//返回属性对象
console.log($(‘#box‘).calendar(‘options‘));
//调整日历大小
$(‘#box‘).calendar(‘resize‘);
//移动到指定日期
$(‘#box‘).calendar(‘moveTo‘, new Date(2015,1,1));
PS:我们可以使用$.fn.calendar.defaults 重写默认值对象。

 

Calendar( 日历)

标签:

原文地址:http://www.cnblogs.com/mylovemygirl/p/5012176.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!