sheet1,和sheet2 始终都在同一个canvas 中绘制的,不牵扯切换的问题。检查下代码逻辑。我这边测试没有问题的。
- $(function () {
- var activeSheet = spread.getActiveSheet();
- var drop = document.getElementById("ss");
- var count = 0, item = "item";
- drop.addEventListener("drop", function (e) {
- var activeSheet = spread.getActiveSheet();
- var hitinfo = activeSheet.hitTest(e.clientX, e.clientY - 8);
- if (hitinfo.hitTestType === GC.Spread.Sheets.SheetArea.viewport) {
- activeSheet.setValue(hitinfo.row, hitinfo.col, item);
- }
- });
- drop.addEventListener("dragenter", function (e) {
- var data = e.dataTransfer.getData("Text");
- item = "item" + count++;
- //item = $("#" + data).text();
- });
- drop.addEventListener("dragleave", function (e) {
- });
- drop.addEventListener("dragover", function (e) {
- e.preventDefault();
- });
- });
复制代码 |