Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

128
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!