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

69
Vistas
Styling linked to attribute not being executed immediately after new attribute is set gridstack

Why do i need to setTimeOut after setting attribute to my div element(chartNode),that belongs under gridstack, which will then change it's css styling, more specifically it's position on the x & y axis in the gridstack, otherwise it will proceed to execute the domToImage.toPng() before the new CSS styling has taken effect.

Question

How do I replace setTimeOut with a more appropriate event handler that waits for the new attribute to be set and new css to be applied before executing domToImage.ToPng?

Code

 let node = document.getElementsByClassName('view-container view-grid-' + view_id[1])[0];
                    // const data = await convertToPng(doc,node,doc_width,doc_height,doc_wh_ratio);

                    let chartNode =  node.querySelectorAll('[gs-id="view1111|mod15"]')[0];
                    chartNode.setAttribute('gs-x',0);
                    chartNode.setAttribute('gs-y',0);
                    console.log(chartNodes);
                    setTimeout(async function () {
                        let dataUrl = await (domtoimage.toPng(chartNode));
                        console.log(dataUrl);
                    }, 1000);
about 4 years ago · Santiago Trujillo
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