javascript - How to add multiple classNames in to fullcalendar event object and deleting with one specified class name - Stack O

Does anyone know how I can add multiple class names in to one event?Currently my event object looks som

Does anyone know how I can add multiple class names in to one event?

Currently my event object looks something like this.

  var eventObject = {
            title: displayText,
            start: item.startDate,
            end : item.endDate,
            allDay:true,
            color: '#BABBBF',
            editable : false,
            className : "user_block"
    }

When I tried something like this

var eventObject = {
                title: displayText,
                start: item.startDate,
                end : item.endDate,
                allDay:true,
                color: '#BABBBF',
                editable : false,
                className : "user_block bday_block"
        };

The following code doesn't seem to excute with normal behaviour where it is suppose to remove all events with the "user_block" class

$("#calendar").fullCalendar('removeEvents', function(event) {
    return event.className == "user_block";
});

Any ideas on how to solve this? Thank you.

Does anyone know how I can add multiple class names in to one event?

Currently my event object looks something like this.

  var eventObject = {
            title: displayText,
            start: item.startDate,
            end : item.endDate,
            allDay:true,
            color: '#BABBBF',
            editable : false,
            className : "user_block"
    }

When I tried something like this

var eventObject = {
                title: displayText,
                start: item.startDate,
                end : item.endDate,
                allDay:true,
                color: '#BABBBF',
                editable : false,
                className : "user_block bday_block"
        };

The following code doesn't seem to excute with normal behaviour where it is suppose to remove all events with the "user_block" class

$("#calendar").fullCalendar('removeEvents', function(event) {
    return event.className == "user_block";
});

Any ideas on how to solve this? Thank you.

Share Improve this question asked Jul 3, 2014 at 22:07 BaconJuiceBaconJuice 3,77915 gold badges59 silver badges90 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

From the documentation:

ClassName: String/Array. Optional. A CSS class (or array of classes) that will be attached to this event's element.

Therefore you should use an array of strings to attach multiple classes to the event.

This should solve your problem:

var eventObject = {
        title: displayText,
        start: item.startDate,
        end : item.endDate,
        allDay: true,
        color: '#BABBBF',
        editable : false,
        className : ["user_block", "bday_block"]
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744904314a4600162.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信