简体   繁体   English

为什么我在 React Table 中收到此错误 - 无法读取未定义的属性 'col11bDataExpanded' - ReactJS

[英]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 col11aDataExpandedcol11bDataExpanded回调,这是在类外未定义的 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.

相关问题 为什么会出现“ TypeError:无法读取未定义的属性” props”(反应路由器,React-Redux)? - Why am I getting 'TypeError: Cannot read property 'props' of undefined' (react-router, React-Redux)? 为什么我得到'无法读取属性'推送'未定义'(React Native)? - Why am I getting 'Cannot read property 'push' of undefined' (React Native)? 为什么我会收到 TypeError:无法读取未定义的 react-router-dom 的属性“push” - Why am I getting TypeError: Cannot read property 'push' of undefined react-router-dom 为什么在此示例中出现“无法读取未定义的属性'文本'”? - Why am I getting “Cannot read property 'text' of undefined” in this example? 为什么我收到“ TypeError:无法读取未定义的属性” length” - Why am I getting 'TypeError: Cannot read property 'length' of undefined' 为什么我得到这个“无法读取未定义的属性”长度”? (JavaScript) - Why am I getting this 'cannot read property 'length' of undefined'? (JavaScript) 我为什么会收到TypeError:无法读取未定义的属性“现在” - Why am I getting TypeError: Cannot read property 'now' of undefined 为什么我在此 for 循环中无法读取未定义的属性“startsWith”? - Why am I getting Cannot read property 'startsWith' of undefined in this for loop? 为什么会出现“无法读取未定义的html属性”? - Why am I getting “Cannot read property of html undefined”? 为什么我越来越无法读取未定义错误的属性? - why I am getting, cannot read property of undefined error?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM