JQuery FullCalendar changes the editable properties of a specific event in the calendar

I am currently using jQuery FullCalendar to create a scheduling application. In my application, I need to set editable = false only for events that are not events created by a registered user; whereas the event created by the registered user must have editable = true. Can anyone suggest to me how I can set some editable event properties in FullCalendar as false and some events as true.

+4
source share
2 answers

Set the main editable property to false and set the event editable property for which you want to change the value 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/

+9
source

I know this question is a little older, but can help anyone looking for this: I did this in two ways: The first is setting the event source, for example @TheSuperTramp:

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

The second is the way I prefer - to set the default value to false and compare when rendering if the event has the same user ID. Thus, you do not "hard code" the attribute of the event:

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

Source: https://habr.com/ru/post/1379083/


All Articles