Reputation: 687
I want to get Grid dom element inside of cell renderer. It is possible?
It because I have to append my component to Grid DOM through createPortal method.
But I don't know how to get grid element inside custom cell renderer.I guess It is can be found inside of ICellRendererParams, but I can not find.
Upvotes: 1
Views: 1981
Reputation: 687
I've put a demo here. It uses ReactDOM's createPortal
to append or remove a <div>
on document.body
when clicking on a button. Its position is absolute
in order to use the top
and left
properties so I can position the div right next to the button.
I've put the popupRef
there to compute its width upon rendering, so that I could offset the popup more to the left. Otherwise, it would completely cover the button due to overlapping corners. setWidth(0)
to see what I mean.
You may use a library like Popper if it makes it easier for you to position the popup.
Upvotes: 1