Drag drop item from list item to scheduler with unit view

[dhtmlxscheduler.txt](github.com/DHTMLX/scheduler/fil … eduler.txt)
[dhtmlxlist.txt](github.com/DHTMLX/scheduler/fil … lxlist.txt)

Hi,
we have defined a layout of pattern: 2U , in the left panel we have attached listbox and rightpanel scheduler has been attached.
Our requirement is to use drag and drop feature to drag an element from list and drop it to scheduler. I used the following method after include “dhtmlxscheduler_outerdrag.js” source : -

scheduler.attachEvent(“onExternalDragIn”, function(id, source, e) {
var listItem = list.get(source.parentObject.id);
scheduler.getEvent(id).text = listItem.Package + " " + listItem.Version;
return true;
});

the above functionality did not work, then I used “onBeforDragIn” event of list and override “scheduler._on_mouse_up” function of scheduler as follows : -

myList.attachEvent(“onBeforeDragIn”, function (context, ev){
// your code here
console.log(‘hello 1’);
dragIn = 1;
listText = context.from.get(context.source[0]).Maintainer;

			var node = document.getElementById('1');
			//var node = document.getElementById('data_container');
			console.log('node is::::::::'+node);
			(new dhtmlDragAndDropObject()).addDraggableItem(node,{
				_createDragNode:function(node){
					var dragSpan=node.cloneNode(true);
					dragSpan.style.position="absolute";
					dragSpan.style.zIndex=12;
					return dragSpan;
				}, 
			});
			node.dragLanding=false;
			
			
			return true;
		});

(function(){
//inject custom mouseup handler
var old = scheduler._on_mouse_up;
scheduler._on_mouse_up = function(e){

			if (dragIn==1){ //debugger;
				var pos=this._mouse_coords(e);
				console.log('pos.x,pos.y'+pos.x + ' , ' + pos.y + '--------- ' + this._table_view);
				
				start=this._min_date.valueOf()+(pos.y*this.config.time_step+(this._table_view?0:pos.x)*24*60)*60000;
				
				start = this._correct_shift(start);
				mode = scheduler.getState().mode;
				console.log('mode inside onMouseUp is ::::: ' + mode);
				console.log(start);
				window.setTimeout(function(){	//timeout is necessary to prevent infinity loop
					
				scheduler.locale.labels.new_event = listText;
				
				if(mode=="unit"){
					
					scheduler.addEventNow({
					start_date: scheduler._get_date_from_pos(pos),
					end_date:   scheduler._get_date_from_pos(pos),
					text:   listText,
					section_id: pos.section
				});
				
				}else
					scheduler.addEventNow(start);
					
				scheduler.locale.labels.new_event = "New Event";
										
				},1)
				dragIn = 0;
				
			} else
				old.apply(this,arguments);
		}
		
		
	})();

the above code is working but It is required to change source code of dhtmlxscheduler.js for unit view and drag from list and drop to scheduler at particular position. It was also required to change in dhtmlxlist.js to make it workable in the current scenario.

To use the unit view we took the file from javaplanner(sample application) , it did not work, then we picked it up from “http://docs.dhtmlx.com/scheduler/codebase/ext/dhtmlxscheduler_units.js”.

can we have source code for dhtmlxscheduler_units.js ?

For your kind concern, we have attached js files. please review it and let us know.

Thanks in advance…
DND_Scheduler.zip (58.7 KB)