restriction - How to set editable as true only for certain users in Fullcalendar -
i using fullcalendar project , wondering how possible set event editable selected users.
i have tried doing didn't seem work
editable: function (event) { if (event.createdby == "admin") { return true } else { return false } },
the editable
option determines if events can dragged , resized. enables/disables both @ same time. not sure event.createdby
call returns "admin"(or other user).
first please check print on console.log()
or alert(event.createdby);
. if can show admin somehow, error in code(like missing semicolon(;) after return true
, return false
in code.
if can take name
(or id
) of 'selected user' variable createdby
, eazy in code below:
change code:
editable: function (event) { if (event.createdby == "admin") { return true } else { return false } },
to this:
editable: (createdby == "admin") ? true:false,
or
editable: (createdid == 1) ? true:false,
please note createdby
, createdid
javascript variables contains selected user's name/id in caledar.js
file (as how handle in project).
it nothing whether use asp, php, or mvc #... how can take uique users in calendar.js
file. there simple(best) way if have id
in hidden item in content page.
that loading value of hidden field js variable like,
var createdid = $( "#idfield" ).val();
or
var createdid = $( ".idfield" ).val();
thank you.
Comments
Post a Comment