Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

134
Vistas
AgGridReact open table in new window

I’m trying to use React’s new Portal function in order to open an AgGridReact component in a pop up window. However, the issue I am running into is when I open the component in a new window, the table functions do not work while the mouse cursor is in the pop up window. However, if I drag my mouse into the original window, the component starts to work, allowing me to change the size of the columns while my mouse is above the original window and not the pop up window.

Specifically, I am creating a new html, then calling

ReactDOM.createPortal(this.props.children, this.containerEl)
(


containerEl

being the created html element). I then attach the new element to the created external window. I then pass

containerEl

as the

popupParent

to the AgGridReact component. If anyone would like to see anymore code I can post as required. But any help or pointers would be greatly appreciated.

Where the AgGridReact is rendered

    const [openedElement, setOpenedElement] = useState()
   
    const updateOpenedElement = val => {
   
      !openedElement && setOpenedElement(val)
  
    } 

    <AgGridReact 
   
    ...
  
     popupParent={openedElement? openedElement: window.document.getElementById("root")}

    ...
    
    >
    </AgGridReact>)

​ And the code for the NewWindow is as follows

    const copyStyles = (sourceDoc, targetDoc) => {...}
    ​
    class NewWindow extends React.Component {
      constructor(props) {
        super(props)
        this.setOpenedElement = props.setOpenedElement
        this.containerEl = document.createElement('div')
        this.externalWindow = null

      }

      render() {
        this.setOpenedElement(this.containerEl)
        return ReactDOM.createPortal(this.props.children, this.containerEl)

      }

      componentDidMount() {

        this.externalWindow = window.open("", "", 
        "width=600, height=400, left=200, top=200")
 
        copyStyles(document, this.externalWindow.document)

        this.externalWindow.document.body.appendChild(this.containerEl)
 
      }
   ​
  
      componentWillUnmount() {
  
        this.externalWindow.close()

      }
    }

​ setOpenedElement is called in a parent component, which I am using in order to create the element popupParent will use.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda