Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery FullCalendar change editable properties of particular event on a calendar

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.

like image 967
Joel James Avatar asked Nov 01 '11 06:11

Joel James


2 Answers

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/

like image 115
Jishnu A P Avatar answered Nov 02 '22 21:11

Jishnu A P


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;
    }
},
like image 43
Brosig Avatar answered Nov 02 '22 21:11

Brosig