【问题标题】:How to access and change selectColumns core method inside react-handsontable?如何访问和更改 react-handsontable 中的 selectColumns 核心方法?
【发布时间】:2018-11-03 05:57:44
【问题描述】:

我想知道,如何访问 react-handsontable 中的 selectColumns 方法。我已经尝试将引用分配给热表组件<HotTable refs="hot"/>,但我仍然无法访问 selectColumns 方法。

感谢您阅读此问题。

【问题讨论】:

    标签: javascript reactjs handsontable


    【解决方案1】:

    @Sagar 还有其他方法吗?如果我们在其他组件中包含 HotTable 并且不能以这种方式渲染它,那就不太方便了。 如果我们从示例中谈到这一行

    const exampleComponent = ReactDOM.render(
    <ExampleComponent />, document.getElementById('example')
    );
    window.hotInstance = exampleComponent.refs.hot.hotInstance;
    

    没关系,当我们将它渲染为一个单独的组件时。但是如果我在 App 组件中导入它,然后通过 ReactDom.render 渲染 App 组件,我没有 refs,只有空对象

    【讨论】:

    • 我正在寻找另一种方法,但我仍在寻找访问核心方法的最佳方法。在 组件这个变量内部可以访问一些方法。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-15
    • 1970-01-01
    • 2015-04-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多