Drag data from DataView to HTML container

 
Drop some item here
</> Source
<!DOCTYPE html>
<html>
<head>
	<title>Drag data from DataView to HTML container</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
	<style>
		body {
			-webkit-user-select: none;
			-moz-user-select: none;
			user-select: none;
		}
	</style>
	<script>
		var myDataView;
		function doOnLoad() {
			dhtmlx.DragControl.addDrop("data_container2",{
				onDrop:function(source, target, d, e){
					var context = dhtmlx.DragControl.getContext();
					var item = context.from.get(context.source[0]);
					var d = document.createElement("DIV");
					d.innerHTML = item.Package+" - "+item.Version;
					target.appendChild(d);
				}
			});
			myDataView = new dhtmlXDataView({
				container:"data_container1",
				type:{
					template:"#Package# : #Version#<br/>#Maintainer#",
					padding:5,
					height:50
				},
				drag:true
			});
			myDataView.load("../common/data.xml");
		}
	</script>
</head>
<body onload="doOnLoad();">
	<h1>Drag data from DataView to HTML container</h1>
	<div id="data_container1" style="border:1px solid #c0c0c0; background-color:white;width:400px;height:396px; float:left;"></div>
	<div style="width:50px; float:left">&nbsp;</div>
	<div id="data_container2" style="background-color:white;width:400px;height:396px;border:1px solid red;overflow:auto; float:left;">Drop some item here</div>
	<div style="clear:both"></div>
</body>
</html>

Documentation

Check documentation to learn how to use the components and easily implement them in your applications.