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


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.

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

kb_11090.zip (87.5 KB)

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);

dhtmlx.com/test/dokuwiki/doku.ph … beforedrag

dhtmlxscheduler.zip (19.2 KB)

Hi there,

Again, thanks very much for the prompt reply.

That works perfectly…

Cheers,

Simon