I am using Fullcalendar for my project and I was wondering how it is possible to set event editable only for selected users.
I have tried doing this but it didn't seem to work
editable: function (event) {
if (event.createdby == "Admin") {
return true
}
else {
return false
}
},
The
editableoption determines if the events can be dragged and resized. Enables/disables both at the same time. I am not sure about theevent.createdbycall returns something like "Admin"(or any other user).First you please check it by print it on
console.log()or simplyalert(event.createdby);. If this can show you Admin somehow, then it is all about the error in your code(like missing semicolon(;) afterreturn trueandreturn falsein your code.If you can take the
name(or evenid) of the 'selected user' to a variable likecreatedby, then it is just eazy as it is in the code below:Change the code:
To this:
OR
Please note that
createdbyandcreatedidare javascript variables than contains selected user's name/id in yourcaledar.jsfile (as how you handle it in your project).It is nothing about whether you use ASP, PHP, or MVC #... look how you can take uique users in the
calendar.jsfile. There is a simple(best) way if you have theidin a hidden item in the content page.That is by loading the value of the hidden field to the js variable like,
OR
Thank you.