@(Html.EJ().TreeGrid("TreeGridContainer").
//…
<script type="text/javascript">
$("#TreeGridContainer").bind("drop", function (e) {
var treeObj = $("#TreeGridContainer").data("ejTreeGrid");
var s = e;
var val = e.originalEvent.dataTransfer.getData("text");
val = val.replace(/\n([^\n]*)$/, '$1').split('\n');
for (var i = 0; i < val.length; i++) {
val[i] = val[i].replace(/\r/, "").split('\t');
var taskItem = { "Id": val[i][0], "Name": val[i][1], "StartDate": val[i][2], "EndDate": val[i][3], "Duration": val[i][4], }
//To select the position for dragged Item
treeObj.addRow(taskItem, ej.TreeGrid.RowPosition.Below);
}
});
$('#TreeGridContainer').bind('dragover', function (e) {
e.preventDefault();
return false;
});
</script> |