本帖最后由 大Vi 于 2022-10-28 09:57 编辑
- function CheckBoxCellType() {
- spreadNS.CellTypes.CheckBox.apply(this);
- }
- CheckBoxCellType.prototype = new spreadNS.CellTypes.CheckBox();
- var basePaint = spreadNS.CellTypes.CheckBox.prototype.paint;
- CheckBoxCellType.prototype.paint = function (ctx, value, x, y, width, height, style, context) {
- var tag = !!(context.sheet.getTag(context.row, context.col, context.sheetArea) || false);
- ctx.fillStyle = "gray";
- basePaint.apply(this, [ctx, tag, x, y, width, height, style, context]);
- };
复制代码- sheet.setCellType(row, col, new CheckBoxCellType()
复制代码 请问,我如果想用你说的继承checkbox类又怎么实现呢? checkbox单元格已经有所有我要的功能,只是要加个填充色,但是这个点击没勾选效果,怎么回事啊? |