Categories | Question details Back To List | ||||||||||||||
DHTMLXScheduler : Setting read-only on an 'eventwise' basis Greetings, I am planning to use the DHTMLXScheduler component in my application which requires some events to be 'read only' (ie cannot be dragged, resized or otherwise 'ediited'), whilst some are editable. After reading through the API documention and knowledgebase, it would appear that a 'read only' property is only made available for the schedule component as a whole, and not for individual events. Is this the case? If so, would there be a way of making individual events 'read only'? I have some ideas which I could try to elaborate on, but was wondering if there was some sort of 'standard' way of achieving this. Thanks in advance, Simon Answer posted by Support on Aug 17, 2009 08:55 >>If so, would there be a way of making individual events 'read only'? Yes, you can use inner events of the component to customize behavior. function readonly_check(id){ var ev = scheduler.getEvent(id); return !ev.readonly; } scheduler.attachEvent("onClick", readonly_check); scheduler.attachEvent("onDblClick", readonly_check); as result, if event has not empty "readonly" property ( can be defined in the same way as any other custom field ) - processing of click and dbl-click event will be blocked, which will prevent event from editing. Answer posted by Simon Irving on Aug 18, 2009 04:24 Hi there, Thanks for the prompt reply! I've tried to apply your method (see test_draggable in attached .zip) but it doesnt seem to work. I may be wrong, but I dont think the onClick event is suitable for this purpose. As I understand it, an onClick event is fired when the left mouse button is pressed and released. In this case of a 'drag' or 'resize', the mouse button is only pressed. I guess we really want to attach a handler to the JavaScript 'onmousedown' event, but this doesnt seem possible via the API. Any ideas? Thanks, Simon Attachments (1)
Answer posted by Support on Aug 18, 2009 07:43 The onDblClick event can be used to block details form. The onClick event can be used to block selection toolbar, which can have edit or details buttons. But previously provided solution is really missing the handling of dragging events. You can use updated version of scheduler ( the same update will be added to the next version ) which adds one more event - onBeforeDrag scheduler.attachEvent("onBeforeDrag", readonly_check); http://dhtmlx.com/test/dokuwiki/doku.php?id=dhtmlxscheduler:event_onbeforedrag Attachments (1)
Answer posted by Simon Irving on Aug 19, 2009 02:43 Hi there, Again, thanks very much for the prompt reply. That works perfectly... Cheers, Simon |