Jquery FullCalendar change editable properties of particular event on a calendar

半腔热情 提交于 2019-12-19 08:12:50

问题


I am currently using jQuery FullCalendar to create a scheduling application. In my application I need to set editable=false only for events which is not an event created by the logged in user; whereas, the event that is created by the logged in user should have editable= true. Can any on suggest me how I could set few editable property of event in a FullCalendar as false and few events as true.


回答1:


Set the master editable property to false and set the editable property of the event's that you want to be editable to true.

$('#calendar').fullCalendar({        
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        editable: false, // set this false
        events: [
        {
            title: 'This must be editable',
            start: new Date('11/1/2011'),
            editable:true
        },
        {
            title: 'This is non editable',
            start: new Date('11/1/2011'),
            end: new Date('11/1/2011')
        }

        ]
    });

});

http://jsfiddle.net/G6K6Y/94/




回答2:


I know that this question is a bit older, but could help anyone searching for this: I've done this by two ways: The first is setting on the event source like @TheSuperTramp did:

{
    title: 'This must be editable',
    start: new Date('11/1/2011'),
    editable:true
}

The second - the way that i prefer - is to set the default value to false and compare at the rendering if the event has the same id of the user. That way you don't "hard code" the atribute on the event:

editable: false,
eventRender: function(event, element) {
    if(event.userId === user.id) {
        event.editable = true;
    }
},


来源:https://stackoverflow.com/questions/7963122/jquery-fullcalendar-change-editable-properties-of-particular-event-on-a-calendar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!