参考下方代码,用tableInsertRowsBelowForContextMenu命令实现table向下插入行
- document.getElementById("insertTableRow").addEventListener("click", function () {
- // 获取当前选中的行索引
- var row = sheet.getActiveRowIndex();
- console.log(row);
- var commandManager = spread.commandManager();
- // commandManager.execute({ cmd: "tableInsertRows", sheetName: sheet.name(), tableName: "table1", row: row + 1, count: 1 })
- commandManager.execute({ cmd: "tableInsertRowsBelowForContextMenu", sheetName: sheet.name(), tableName: "table1", isAfter: true, row: row, count: 1 })
- })
复制代码
|