[英]Why I am getting this errors in React Table - Cannot read property 'col11bDataExpanded' of undefined - ReactJS
I am working with React Table.我正在使用 React Table。 This is my Demo - https://codesandbox.io/s/m5nn9ko90p
这是我的演示 - https://codesandbox.io/s/m5nn9ko90p
I am trying to get the rowindex of some specific columns in my Table.我正在尝试获取表中某些特定列的行索引。
I am getting the index properly but I am getting this errors when I click on columns 11a and 11b:我正在正确获取索引,但是当我单击第 11a 和 11b 列时出现此错误:
Cannot read property 'col11aDataExpanded' of undefined
无法读取未定义的属性“col11aDataExpanded”
Cannot read property 'col11bDataExpanded' of undefined
无法读取未定义的属性“col11bDataExpanded”
Can you kindly look into this problem and update my CodeSandbox by getting rid of this issue.您能否通过解决此问题来查看此问题并更新我的 CodeSandbox。
Your const columns = [...
array is defined outside your class, but you have callbacks, specifically your col11aDataExpanded
and col11bDataExpanded
callbacks that reference this
, which is OFC undefined outside the class.您的
const columns = [...
数组是在您的类之外定义的,但是您有回调,特别是引用this
col11aDataExpanded
和col11bDataExpanded
回调,这是在类外未定义的 OFC。 Move your columns
definition into your class and it'll work now.将您的
columns
定义移动到您的类中,它现在就可以工作了。
https://codesandbox.io/s/x9r93koxn4 https://codesandbox.io/s/x9r93koxn4
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.