找回密码
 立即注册

QQ登录

只需一步,快速开始

Lynn.Dou讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2022-6-2 18:31:11
2#
您好,
您可以参考下方链接教程,利用自定义单元格实现:
https://gcdn.grapecity.com.cn/forum.php?mod=viewthread&tid=88223
回复 使用道具 举报
最佳答案
最佳答案
Lynn.Dou讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2022-6-2 10:31:41
来自 6#
请参考附件demo,主要代码如下:
  1. // 设置自定义单元格
  2.             function BindingPathCellType() {
  3.                     spreadNS.CellTypes.Text.call(this);
  4.                 }
  5.                 BindingPathCellType.prototype = new spreadNS.CellTypes.Text();
  6.                 BindingPathCellType.prototype.paint = function (ctx, value, x, y, w, h, style, context) {
  7.                     if (value === null || value === undefined) {
  8.                         var sheet = context.sheet, row = context.row, col = context.col;
  9.                         if (sheet && (row === 0 || !!row) && (col === 0 || !!col)) {
  10.                             var bindingPath = sheet.getBindingPath(context.row, context.col);
  11.                             if (bindingPath) {
  12.                                 value = "[" + bindingPath + "]";
  13.                             }
  14.                         }
  15.                     }
  16.                     spreadNS.CellTypes.Text.prototype.paint.apply(this, arguments);
  17.                 };
  18.                 var bindingPathCellType = new BindingPathCellType();
复制代码

测试结果如下图:
image.png610139159.png

按钮控制绑定字段显示.html

6.77 KB, 下载次数: 71

回复 使用道具 举报
12
您需要登录后才可以回帖 登录 | 立即注册
返回顶部