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

130
Vistas
Issue selecting column and row of selection on bokeh Datatable

I have a datatable which I am plotting via bokeh --serve. Upon clicking a value I want to return the row and column values to a ColumnDataSource (info_source), which I can then use in some following work through a python call from the same trigger. The issue is that the columns and rows are not populating the ColumnDataSource. I am not familiar with Javascript so having trouble debugging. Any pointers much appreciated.

source_1 = ColumnDataSource(df) 
        columns = ['x','y','z']
        data_table_1 = DataTable(columns=columns, source=source_1)
        data_table_1.height = 800
    
    
info_source = ColumnDataSource(dict(row = [], column = [])) 
code = """
var grid = document.children;
var row, column = '';


for (var i = 0,max = grid.length; i < max; i++){
    if (grid[i].outerHTML.includes('active')){
        row = i;
        for (var j = 0, jmax = grid[i].children.length; j < jmax; j++)
            if(grid[i].children[j].outerHTML.includes('active')) 
                { column = j }
    }
}

info_source.data = {row:[row],column:[column]};

"""
        
    def py_callback(attr, old, new):
        
        source_1.selected.update(indices = [])

    def py2_callback(attr, old, new):
        
        print(info_source.data)


        
    plot_fwd = figure(x_axis_type='datetime',plot_width=400, plot_height=335)
    source_1.selected.on_change('indices', py_callback)
    callback = CustomJS(args = dict(source_1 = source_1, info_source=info_source), code = code)
    source_1.selected.js_on_change('indices', callback)
    source_1.selected.on_change('indices', py2_callback)`
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