【问题标题】:Handsontable: Getting HoT object in 'cells' functionHandsontable:在“细胞”功能中获取热对象
【发布时间】:2015-12-15 13:25:26
【问题描述】:

我正在从旧版本的 HandsOnTable 升级,但在获取单元格函数中的 HoT 对象时遇到了一些问题,例如:

cells: function (row, col, prop) {
            var cellProperties = {};
            cellProperties.className = 'htMiddle htCenter';



            if (hot.getDataAtRowProp(row, "Team") == "Boston Celtics")
                console.log("Celtics");




            return cellProperties;
        }

未捕获的类型错误:无法读取未定义的属性“getDataAtRowProp”

到那时HoT对象不应该可用吗?

我要做的是检查特定单元格的值,以了解是否应该更改此列的渲染器。

http://jsfiddle.net/b5kagLzx/

【问题讨论】:

    标签: javascript handsontable


    【解决方案1】:

    您遇到了范围界定问题。您可以通过 this.instance 访问 hot 对象,因此只需将代码更改为

    if (this.instance.getDataAtRowProp(row, "Team") == "Boston Celtics")
    

    这应该有效(它在你的小提琴中)

    【讨论】:

      猜你喜欢
      • 2015-05-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-09
      • 1970-01-01
      • 2017-02-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多