Dav*_*vid 3 jquery json fullcalendar
我使用FullCalendar的json events属性来调用一个返回JSON字符串的php脚本.该字符串具有必需的属性以及一些额外的内容,如"描述".该文档说您可以添加属性,但没有关于如何执行此操作的信息.
我查看是否通过在eventRender回调中查看'event.description'(例如)来自动添加它.这是'未定义'.
如果有人对此有任何经验,我会很感激如何做到这一点.
大卫
创建新的FullCalendar事件时,可以包含任何其他属性以及事件.FullCalendar将忽略任何额外的属性,因此您必须编写一些脚本来添加和显示它们.
例如,添加事件位置或描述将按如下方式完成:
var event = {
id : '123',
title : 'New Event',
url : 'http://thearena.com/',
start : "Sun, 18 Jul 2010 13:00:00 EST",
end : "Sun, 18 Jul 2010 17:00:00 EST",
allDay : false,
location : 'The Arena',
description : 'Big Event',
editable : true
};
$('.fc').fullCalendar( 'renderEvent', event, true ) // Add Event to fullCalendar
// Add script here to post the event back to your server
Run Code Online (Sandbox Code Playgroud)
然后确保在初始化日历脚本时,您可以通过某种方式显示此额外事件信息.以下是事件点击功能显示警报窗口(或面板灯箱 - 注释掉)中的数据的示例.如果存在URL,它也会在新的选项卡/窗口中打开它.
$('.fc').fullCalendar({
eventClick: function(calEvent, jsEvent, view) {
var event = 'Event: ' + calEvent.title + '<br>' +
'Location: ' + calEvent.location + '<br>' +
'Start time: ' + calEvent.start + '<br>' +
'End time: ' + calEvent.end + '<br>' +
'Description: ' + calEvent.description;
alert(event);
// jQuery.facebox(event); // this would open the HTML in a facebox popup window
if (calEvent.url) {
window.open(calEvent.url);
return false;
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9493 次 |
| 最近记录: |