最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Add more fieldsdata to a FullCalendar day - Stack Overflow

programmeradmin6浏览0评论

I am working on a web app using the FullCalendar JQuery plugin to display the absence/presence of workers each day in a pany.

I need to display several types (or fields) of information in each day. For example, I would like to display for each day: a Title (ex. "John is absent"), and Percentage(ex, "95% assistance"). And I would like this percentage to appear with a different format, on the bottom right corner of each day's box.

As far as I've seen, the possible fields to describe an event are basically these ones:

        events: [
        {
            title: 'John is sick',
            start: '2013-11-19',
            allDay: true
        },
        {
            title: 'Mike is on vacation',
            start: '2013-11-21',
            end: '2013-11-26',
            allDay: true
        }
    ]

Is there any way to add more fields (like the porcentage of assistance) to a FullCalendar day?

Edit: thanks to Henrique C's answer I managed to do it. Just to plete a little more the answer I would like to add that besides, doing what Henrique said in his answer, it is also necessary to do something like this:

$('#calendar').fullCalendar({
events: [
    {
        title: 'My Event',
        start: '2010-01-01',
        description: 'This is a cool event'
    }
    // more events here
],
eventRender: function(event, element) {
    element.qtip({
        content: event.description
    });
}

});

I am working on a web app using the FullCalendar JQuery plugin to display the absence/presence of workers each day in a pany.

I need to display several types (or fields) of information in each day. For example, I would like to display for each day: a Title (ex. "John is absent"), and Percentage(ex, "95% assistance"). And I would like this percentage to appear with a different format, on the bottom right corner of each day's box.

As far as I've seen, the possible fields to describe an event are basically these ones:

        events: [
        {
            title: 'John is sick',
            start: '2013-11-19',
            allDay: true
        },
        {
            title: 'Mike is on vacation',
            start: '2013-11-21',
            end: '2013-11-26',
            allDay: true
        }
    ]

Is there any way to add more fields (like the porcentage of assistance) to a FullCalendar day?

Edit: thanks to Henrique C's answer I managed to do it. Just to plete a little more the answer I would like to add that besides, doing what Henrique said in his answer, it is also necessary to do something like this:

$('#calendar').fullCalendar({
events: [
    {
        title: 'My Event',
        start: '2010-01-01',
        description: 'This is a cool event'
    }
    // more events here
],
eventRender: function(event, element) {
    element.qtip({
        content: event.description
    });
}

});

Share Improve this question edited Nov 21, 2013 at 17:45 Xar asked Nov 19, 2013 at 11:49 XarXar 7,98020 gold badges61 silver badges92 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

Non-standard Fields This was taken from Fullcalendar website.

In addition to the fields above, you may also include your own non-standard fields in each Event Object. FullCalendar will not modify or delete these fields. For example, developers often include a description field for use in callbacks such as eventRender.

You can add any fields you want, fullcalendar will not change them.

events: [
    {
        title: 'John is sick',
        start: '2013-11-19',
        allDay: true,
        description: 'Hurrayyyyyyyyyy',
        myotherspecialfield: ':P'
    },
    {
        title: 'Mike is on vacation',
        start: '2013-11-21',
        end: '2013-11-26',
        allDay: true,
        description: 'Hurrayyyyyyyyyy'
        myotherspecialfield: ':P'
    }
]
发布评论

评论列表(0)

  1. 暂无评论