Bokeh table - editable source.selected.js_on_change

Hi,

I have a bokeh DataTable that is editable. But when the user edits the table, they need to press enter, enter the value click enter again and then click down and back up again on the row it edited for it to change the other columns. I am running the changes like this:

        source.selected.js_on_change('indices', CustomJS(args=dict(source = source, 
                                                                values = values), code="""

Am I doing this wrong? The user thinks its a bit tedious to have to click on a row edit, click down and up again for it to change. Is there another way of doing this? I am running a bokeh server, so could change to on_change instead?

Working solution here I think ā†’ python - Callback to datatable when user changes a content of cell - Stack Overflow

js_on_change('patching', cb) is the real key

1 Like

I have successfully used

data_table.source.js_on_change("data", on_data_change)

before too, FYI

1 Like

Hi,

I started by trying the first solution here:

        source.js_on_change('patching', CustomJS(args=dict(source = source, 
                                                                values = values), code="""

And that worked perfectly. Thank you very much.
Iā€™m too lazy to try the second one, but I am sure it works too #iamalazyprogrammer :stuck_out_tongue_winking_eye: