Reputation: 90
How can I drag a text from (a node from a treeview) in TaskPane and add it to the dropped cell in Excel using Office JS. I have tried HTML 5 drag and drop
function allowDrop(ev) {
ev.preventDefault();
}
function drag(ev) {
ev.dataTransfer.setData("text", ev.target.id);
}
function drop(ev) {
ev.preventDefault();
var data = ev.dataTransfer.getData("text");
ev.target.appendChild(document.getElementById(data));
}
But I dont know what to use inside ev.target.appendChild(document.getElementById(data));
instead of data
Kindly note that I don't need to use jQuery like what was used in the Wikipedia Office add-in sample.
Upvotes: 0
Views: 948
Reputation: 2478
Drag and drop is not supported. There is no easy substitute here. If the scenario doesn't require a lot of drag-drops, you could use the double-click (on add-in taskpane) to update current active cell with the data and move cell selection to next logical cell (right, down, etc.) to allow next update.
Upvotes: 1