react-bootstrap-table icon indicating copy to clipboard operation
react-bootstrap-table copied to clipboard

Uncaught TypeError: Cannot read property 'getDOMNode' of undefined

Open urahonky opened this issue 11 years ago • 11 comments

Hi there Mr. Fang,

I have run into an issue and I suspect that it's pretty unique but it's causing me some problems. I'm getting the following error message:

Uncaught TypeError: Cannot read property 'getDOMNode' of undefined

And this occurs here:

_adjustHeaderWidth: {
      value: function _adjustHeaderWidth() {
        this.refs.table.getDOMNode().childNodes[0].childNodes[0].style.width = this.refs.table.getDOMNode().childNodes[1].childNodes[0].offsetWidth - 1 + "px";
      }
    },

It seems to occur when I draw the Table on the page and then remove it. In my application they have something similar to tabs. On the third tab it shows this table. When they click off of the tab the table stops being rendered. After that if they resize their window the console gets filled with that error message.

I'm not quite sure how to handle this on your end. I'd maybe look to see how other react components are unmounting or something. Do you need me to write up a quick and dirty example?

urahonky avatar Aug 11 '15 14:08 urahonky

Hi @urahonky, maybe give me a quick sample, I can debug it. :))

AllenFang avatar Aug 12 '15 06:08 AllenFang

Sorry Mr. Fang... Work has been crazy today. Hopefully I get a break tomorrow for me to write up a quick example.

urahonky avatar Aug 12 '15 20:08 urahonky

that's ok, take your time :)

AllenFang avatar Aug 13 '15 01:08 AllenFang

BootstrapTable.js:294 Uncaught TypeError: Cannot read property 'getDOMNode' of undefined Can this help? version 0.9.7

chuchengcao avatar Aug 13 '15 02:08 chuchengcao

Hi @chuchengcao I probably know the problem is just the this.ref.table does not exist, and add a if condition maybe a quickly solve way. But I want to know what condition and why caused it :)

Anyway, so can you tried out this issue also?

AllenFang avatar Aug 13 '15 02:08 AllenFang

Hi, @AllenFang , thank you for reply. I think I found the method to repeat the problem.

  1. Transition to a page which render the React-bootstrap-table;
  2. Transition to another page which does not contain the React-bootstrap-table;
  3. Change the view port height (alter the brower height for example)
  4. Got the error
  5. Even though we transition to the page which render the React-bootstrap-table again, the problem still exist; Source code is a bit too many, do you need the source code?

chuchengcao avatar Aug 13 '15 03:08 chuchengcao

OK, I got it. I'll check it out, thanks very much :)

AllenFang avatar Aug 13 '15 13:08 AllenFang

I got the same problem when I resize the browser window. 2015-08-23 1 44 34

LeeChSien avatar Aug 23 '15 05:08 LeeChSien

Hi @chuchengcao, @LeeChSien, I follow your instruction but I can't get this problem. how you change the page or can give some certainly example ?

AllenFang avatar Aug 25 '15 13:08 AllenFang

I've fixed this problem by avoiding this error happened for a temporary solution, if any bug appear, plz report. However, update to v0.9.11 and check it out :)

AllenFang avatar Aug 27 '15 12:08 AllenFang

No such errors anymore :)

chuchengcao avatar Sep 01 '15 02:09 chuchengcao