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

245
Vistas
DASH Javascript client-side call back precedes Python triggered call_back

I have a dash app, where a Print button executes a window print in Javascript using a client-side callback. I would like the Print button to trigger a python call-back BEFORE it triggers the Javascipt window-print so that I can hide a layout feature and prevent it from being displayed. No matter what I try, the javascript print window opens first and only on closing that window does the other python call-back get triggered. Is there a work around? Thx

dbc.Button('Print Record', id='printing', outline=True, className="d-print-none",
                                   n_clicks=0,)

@app.callback(
    [,
        Output("printing", "n_clicks"),
    ],

    [Input("printing", "n_clicks")],
)
def toggle_sidebarnclick(n):
    "code toggles a layout feature so it doesn't appear on the screen"

    return n

app.clientside_callback(
    """
    function(clicks) {
        if (clicks > 0) {
          try {
  document.execCommand('print', false, null);
}
catch(e) {
  window.print();
}
        }
        return 
    }
    """,
    Output('hidden-content', 'children'),
    Input('printing', 'n_clicks')
)



about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The solution is simple:

{
setTimeout(window.print, 1000)
}
about 4 years ago · Juan Pablo Isaza Denunciar
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