把Jquery代码转成js,代码如下?

adsasdaszzz 2021-09-01 22:58:30

$(document).ready(function () {
var spread = new GcSpread.Sheets.Spread($("#ss").get(0), { sheetCount: 1 });
var sheet = spread.getActiveSheet();
sheet.setCellType(0, 0, new MyCheckBoxCellType(), GcSpread.Sheets.SheetArea.colHeader);
});

function MyCheckBoxCellType() {
GcSpread.Sheets.CheckBoxCellType.apply(this);
this.caption("操作");
}
MyCheckBoxCellType.prototype = new GcSpread.Sheets.CheckBoxCellType();
var basePaint = GcSpread.Sheets.CheckBoxCellType.prototype.paint;
MyCheckBoxCellType.prototype.paint = function (ctx, value, x, y, width, height, style, context) {
var tag = context.sheet.getTag(context.row, context.col, context.sheetArea);
if (tag !== true) {
tag = false;
}
basePaint.apply(this, [ctx, tag, x, y, width, height, style, context]);
};
MyCheckBoxCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
if (context) {
return { x: x, y: y, row: context.row, col: context.col, cellRect: cellRect, sheetArea: context.sheetArea, isReservedLocation: true, sheet: context.sheet };
}
return null;
};

MyCheckBoxCellType.prototype.processMouseUp = function (hitInfo) {
var sheet = hitInfo.sheet, row = hitInfo.row, col = hitInfo.col, sheetArea = hitInfo.sheetArea;
var tag = sheet.getTag(row, col, sheetArea);
if (tag === undefined || tag === null) {//first time
sheet.setTag(row, col, true, sheetArea);
} else {
sheet.setTag(row, col, !tag, sheetArea);
}
//add your code here
tag = sheet.getTag(row, col, sheetArea);
var rownum = sheet.getRowCount();
for (let i = 0; i < rownum; i++) {
sheet.setValue(i, 0, tag);
}
};

...全文
261 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
CSDN-Ada助手 2023-01-13
  • 打赏
  • 举报
回复
您可以前往 CSDN问答-编程语言 发布问题, 以便更快地解决您的疑问

87,988

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧