FullCalendar调用gotoDate并以编程方式设置firstDay [英] FullCalendar call gotoDate and set firstDay programatically

查看:1583
本文介绍了FullCalendar调用gotoDate并以编程方式设置firstDay的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将自定义按钮添加到日历的标题中,该标题包含每年的每个月。这个想法是,你可以选择月份,日历将跳转到那个月份。

I have added a custom button to the header of the calendar that has each month of the year in it. The idea is that you can select the month and the calendar will jump to that month.

我目前的firstDay设置为1,以启动一个星期一的日历,这是因为在大多数情况下,我希望星期一成为第一天。当我打电话给gotoDate时,我希望日历能够跳到日期,这是日历上的第一个可见日期;它应该始终是所选月份的第一个月份。

I currently have firstDay set to 1 to start the calendar on a Monday, this is because in most scenarios I do want Monday to be the first day. When I call gotoDate I would like the calendar to jump to that date with it being the first visible day on the calendar; it should always be the 1st of the selected month.

目前它到了日期,但第一天是该周的星期一。

Currently it goes to the date but the firstDay is Monday of that week.

我搜索了一下,看是否可以找到其他人尝试实现此目的,并且遇到了这个问题,但这是FC的老版本,我使用2.7

I have searched to see if I could find anyone else trying to achieve this and came across the this issue but this was for quite an old version of FC, I am using 2.7

有没有一种方法可以务实设置第一天而不分叉日历并更改内部代码?

Is there a way to pragmatically set the firstDay without forking the calendar and changing the internal code?

任何帮助将不胜感激。

*我没有包含任何代码,因为我没有认为它会给问题增加任何价值。我没有调用任何设置第一天,而不是初始化时。

*I haven't included any code because I don't think it would add any value to the question. I am not calling anything to set the firstDay other than when it is initialised.

推荐答案

我发现从版本2.9开始,已于2016年7月11日发布支持,以便动态获取和设置选项。

I have found that as of version 2.9, released on the 11th July 2016 support has been added for getting and setting options dynamically.

我已经从版本2.7升级到2.9,并设法使用以下代码设置firstDay在日历初始化后。

I have upgraded from version 2.7 to 2.9 and managed to use the following code to set firstDay after the calendar is initialised.

$('#calendar').fullCalendar('option', 'firstDay', 0);

The documentation for Get/Set Options Dynamically, not all options can be set dynamically.

GitHub 问题,增加了功能。

The GitHub issue that added the functionality.

这篇关于FullCalendar调用gotoDate并以编程方式设置firstDay的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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