如何禁用fullcalendar中的某些日期范围? [英] How can I disable some dates range in a fullcalendar?

查看:284
本文介绍了如何禁用fullcalendar中的某些日期范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想禁用日期范围前后的日期,任何人都知道我该怎么做? (对不起我的英语不好)。



Hernan

解决方案

不想让人们预定某些日期?

看看这个链接

http://jsfiddle.net/ppumkin/7MTdn/



15天后点击一天,警报更改..这样的事情?是的



如果这就是你的意思,我可以尝试改变它以满足你的需求..

  $('#mycalendar')。fullCalendar(
{
header:{
left:'prev,next today',
center:'title ',
right:'month,agendaweek,agendaDay'
},


dayClick:function(date,allDay,jsEvent,view){
var myDate = new Date();

//从今天开始添加多少天
var daysToAdd = 15;

myDate.setDate(myDate.getDate ()+ daysToAdd);

if(date< myDate){
// TRUE点击日期小于今天+ daysToadd
alert(您无法在这一天预订! );
}
else
{
// FLASE点击日期大于今天+ daysToadd
alert(极好的选择!我们可以今天预订..);
}


},

事件:[

{
title:'event2',
start:'2011-03-10',
end:'2011-05-5'
}
]
} );

请注意,这是为1.6.4编写的,而版本2+大部分的API已经改变,事情应该有所不同,但一般事件和逻辑应该是相同的。


I want to disable days before and after dates range, anybody know how can I do that? (sorry for my english).

Hernan

解决方案

so you mean on the ACTUAL calendar you don't want people to book certain dates?

Look at this link

http://jsfiddle.net/ppumkin/7MTdn/

Click on a day 15 days later and the alert changes.. something like this? Yea

If that is what you mean i can try and change it for your needs..

$('#mycalendar').fullCalendar(
            {
             header: {
                    left: 'prev,next today',
                    center: 'title',
                    right: 'month,agendaWeek,agendaDay'
                    },


                dayClick: function( date, allDay, jsEvent, view ) { 
                    var myDate = new Date();

                    //How many days to add from today?
                    var daysToAdd = 15;

                    myDate.setDate(myDate.getDate() + daysToAdd);

                    if (date < myDate) {
                        //TRUE Clicked date smaller than today + daysToadd
                    alert("You cannot book on this day!");    
                    }
                    else
                    {
                        //FLASE Clicked date larger than today + daysToadd
                        alert("Excellent choice! We can book today..");    
                     }   


            },      

             events: [

                        {
                            title  : 'event2',
                            start  : '2011-03-10',
                            end    : '2011-05-5'
                        }
                    ]
           }); 

Please note this was written compatible for 1.6.4 and that from version 2+ most of the API has changed and things should be different but the general events and logic should be the same.

这篇关于如何禁用fullcalendar中的某些日期范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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