Categories | Question details Back To List | ||
Disable Scheduler Calendar Event I'm wondering if it's possible to disable a calendar event if the color of the event meets a certain criteria? I have some events which are colored grey (using css). Is it possible (having access to the color / event style) to disable this event from either editing or dragging / resizing while all other events can still be dragged / resized /edited? Thanks, Steve Answer posted by Support on Sep 02, 2009 00:45 Please check the next article, it shows how you can make a readonly event based on any event's property. http://www.dhtmlx.com/docs/products/kb/index.shtml?cat=kb&q=11090 Answer posted by Steve on Sep 02, 2009 07:49 I've read the link that you provided and attempted to implement the solution, but it doesn't work for me. I'm using build 90722 which is pretty new. Here is what I've done. scheduler.attachEvent("onBeforeDrag", readonly_check); function readonly_check(id){ alert(id); var ev = scheduler.getEvent(id); return !ev.readonly; } I'm a bit confused as to how this is suppose to stop the drag of a specific event (based on the style / color of the event). Answer posted by Support on Sep 02, 2009 10:10 >>I'm using build 90722 Please update your version of js file with one , which attached in the above post. onBeforeDrag event was added after build 90722 and not included in any officially released version yet. >>I'm a bit confused as to how this is suppose to stop the drag of a specific event The color of event is defined based on some other property of event object, right? So you can use the same property inside the readonly_check return some_check_against(ev.some_field); If it still doesn't work for you - we can provide some kind of sample. Answer posted by Steve on Sep 02, 2009 10:47 Okay we are making progress... Here is what I have currently. // disable task events scheduler.attachEvent("onBeforeDrag", readonly_check); function readonly_check(id){ var ev = scheduler.getEvent(id); return (event.task?!ev.readonly:ev.readonly); } When this is done, none of the calendar events are movable (only wanted the task events - events with a task node in xml none movable). All events are still editable. Note: only task events have a node "task", all other events don't have this node. Thanks for the help Answer posted by Steve on Sep 02, 2009 11:00 Okay I figured it out. Wasn't thinking it through. Here is what I have. It disables moving, editing (single & double click) for events where there is a node called task // disable task events scheduler.attachEvent("onBeforeDrag", readonly_check); scheduler.attachEvent("onClick", readonly_check); scheduler.attachEvent("onDblClick", readonly_check); function readonly_check(id){ var ev = scheduler.getEvent(id); return (ev.task?false:true); } Thanks again for your help. |