gpt4 book ai didi

php - FullCalendar - 限制范围

转载 作者:行者123 更新时间:2023-11-29 22:25:53 25 4
gpt4 key购买 nike

如何(我必须在代码中更改什么)将 View 范围(通过用户使用按钮)限制为仅查看:

在周 View 中 - 只有实际的一周,无法查看上一周和下一周

在日 View 中 - 当然是实际的一天,并且有一种方法可以仅查看实际一周中的几天(按钮上一个和下一个)。

(在月 View 中——我不使用这个 View ,没有月按钮(我知道如何消除月按钮))

如何从周 View 中删除按钮(上一个/下一个)?

我只想使用实际周 View 和实际周中的天数(在天 View 中)。

附言。也许它有帮助 - 我有两个额外的变量(来自 php TimeZone 部分):

$date1 - 这是实际一周(星期一)的第一天(日期)

$date7 - 这是实际一周(星期日)的最后一天(日期)

最佳答案

要隐藏上一个和下一个按钮,您可以使用 jQueries 功能按类或 ID 隐藏元素。

$('.fc-button-prev, .fc-button-next').hide();

这样你就可以随时重新显示它们,但如果你不想使用它,只需使用 following methods 构建你的 fulclalendar

    header: {
left: 'today',
center: 'prev,title,next',
right: 'month,basicDay'
},

要使用下拉菜单更改日期,请从服务器 PHP 端以您希望的方式填充选择,

例如我的 php 写了这个..(只有部分代码,但是例如)

"<option <?php echo 'value=\'' . $date1 . '\'>' . $date1; ?> - Monday</option>" +

生成的 HTML 应该是这样的

<option value="2012-02-27">2012-02-27 - Monday</option>

然后再次使用 jQuery 的强大功能...

        $('#myDateSelector').change(function() {
var selectedText = $('#myDateSelector option:selected').text(); //Gets the TEXT
var selectedValue = $('#myDateSelector option:selected').val(); //gets the Value='abc'

var selectedDate = new Date(selectedValue);
$('#calendar').fullCalendar('gotoDate',selectedDate);
} );

Another answer of mine show more complex code on how to control fullcalendar, but it uses ASP server tags not PHP.. the JavaScript is still the same logic though.

关于php - FullCalendar - 限制范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9410955/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com