在datepicker中突出显示假期 [英] highlight holidays in datepicker

查看:73
本文介绍了在datepicker中突出显示假期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





i我在asp.net中使用jquery ui datepicker。

在日历中我需要突出显示(通过改变颜色等) 。)从sql server获取的假期。



请帮助我什么程序将假期列表从数据库绑定到jquery ui calendar ???





提前感谢....

解决方案

  //  要突出显示的日期列表 
var dates = [
[ 2011 8 1 ],
[ 2011 8 9 ],
[ 2011 8 25 ]
];


' #datepicker')。datepicker({
beforeShowDay:function(date){
var year = date.getFullYear(),month = date.getMonth(),day = date.getDate();

// 查看当前日期是否应突出显示
for var i = 0 ; i < dates.length; ++ i)
if (year == dates [i ] [ 0 ]&& month == dates [i] [ 1 ] - 1 && day == dates [i] [ 2 ])
return [ false ' UI-状态高亮'];

return [ false ];
}
});



原始答案: http://stackoverflow.com/questions/7054039/jquery-ui-datepicker-as-multiple-date-display [ ^ ]


< blockquote>我使用webmethod获得解决方案


hi,

i am using jquery ui datepicker in asp.net.
In calendar i need to highlight(by changing color etc.) holidays which was fetched from sql server.

will any please help me what was the procedure to bind holidays list from database to jquery ui calendar???


thanks in advance....

解决方案

// list of dates to highlight
var dates = [
    [2011, 8, 1],
    [2011, 8, 9],
    [2011, 8, 25]
];


('#datepicker').datepicker({ beforeShowDay: function (date){ var year = date.getFullYear(), month = date.getMonth(), day = date.getDate(); // see if the current date should be highlighted for (var i=0; i < dates.length; ++i) if (year == dates[i][0] && month == dates[i][1] - 1 && day == dates[i][2]) return [false, 'ui-state-highlight']; return [false]; } });


Original answer : http://stackoverflow.com/questions/7054039/jquery-ui-datepicker-as-multiple-date-display[^]


i got the solution using webmethod


这篇关于在datepicker中突出显示假期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆