Maxim
Maxim

Reputation: 11

HOC(Multigrid) from react-virtualized strange update method

I use Multigrid to create a scrolling table. There is a requirement: to be able to manually change the widths of columns, including the header column (sidewall)

Example: https://codesandbox.io/p/sandbox/sharp-sinoussi-ydqmmq

There is a problem when I try to make a redesign for the sidewall enter image description here

It changes its size, but the entire Multigrid is not redrawn.

enter image description here

But if you change the width of another column, everything will work well.

Also, if you change the width of the sidewall and make a scroll, then the entire Multigrid will be drawn as it should be

There is a recomputeGridSize() method

But now I'm starting to think about this:

What is essentially a Multigrid combines several Grid components

enter image description here

And when I apply this.grid.recomputeGridSize()

I'm updating the entire Multigrid (I don't know which part, but not all)

And if I had updated something else when executing _resizeCol, everything would have been successful.

I've already tried to fix it. But so far I have found that the new width is being recorded correctly. I don't know what to do next.

Upvotes: 1

Views: 75

Answers (1)

Maxim
Maxim

Reputation: 11

Resolve problem!

Add this

this.grid.forceUpdate();

to _resizeCol methods into "setState" second parametr, after "recomputeGridSize"

Upvotes: 0

Related Questions