Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Tom on Oct 13, 2009 13:29
open dhtmlx forum
dhtmlXScheduler

What would be the recommended approach to allowing drag and drop support for only certain events on a calendar?

For example, currently you can use dhtmlXScheduler.config.drag_create,dhtmlXScheduler.config.drag_move, and dhtmlXScheduler.config.drag_resize to control drag and drop in a global way.
Answer posted by Stanislav (support) on Oct 14, 2009 02:24
Answer posted by Tom on Oct 14, 2009 11:07
The onBeforeDrag event doesn't appear to exist in the latest sources I can find, such as from: http://dhtmlx.com/docs/products/kb/index.php?s=normal&q=12169&a=19733

For example this seems to be the current logic in scheduler._on_mouse_down:
    if (this._drag_mode){
        if (!this.config["drag_"+this._drag_mode])
            this._drag_mode=this._drag_id=0;
        else {
            this._drag_id=this._locate_event(src);
            this._drag_event=this._copy_event(this.getEvent(this._drag_id)||{});
        }
    }

vs the following in the examples provided:
    if (this._drag_mode){
        var id = this._locate_event(src);
        if (!this.config["drag_"+this._drag_mode] || !this.callEvent("onBeforeDrag",[id, this._drag_mode, e]))
            this._drag_mode=this._drag_id=0;
        else {
            this._drag_id= id;
            this._drag_event=this._copy_event(this.getEvent(this._drag_id)||{});
        }
    }

Answer posted by Stanislav (support) on Oct 15, 2009 04:03
While existing version ( 2.0 ) doesn't support such functionality - it will be added in 2.1.
The link, provided above, http://www.dhtmlx.com/docs/products/kb/index.shtml?cat=kb&q=11090 has the updated version of scheduler attached ( check the last post in the thread ) which is existing version of scheduler with necessary event added.