☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

User input into datatable

Community Support
gli25
gli25

I have a datatable and would like to make one column editable by the user, so that they can simply click on the desired box, and type in the value. I don’t want the user to be able to edit any other columns. How would I do this?

⌁   Link to post
gli25
gli25

I write some code myself which can solve part of the problem, but still expect better solution.

import numpy as np

import pandas as pd

from bokeh.models import ColumnDataSource

from bokeh.io import curdoc

from bokeh.models.widgets import TextInput,DataTable,TableColumn,NumberEditor

from bokeh.layouts import row,widgetbox

data = pd.DataFrame({‘date’: pd.date_range(start = ‘2016-6-6’,end = ‘2020-6-30’,freq = pd.DateOffset(years = 1)),

‘price’:[2,3.5,2,2.8,3.2],

‘profit’:[0]*5})

source = ColumnDataSource(data)

columns = [TableColumn(field = data.columns[0],title =‘DATE’),

TableColumn(field = data.columns[1],title = ‘PRICE’),

TableColumn(field = data.columns[2],title = ‘PROFIT’)]

Table = DataTable(source = source, columns = columns,editable = True)

textboxes =

for i in range(len(data)):

textboxes.append(TextInput(title = 'today_profit', value = 'default'))

def update_data(attrname,old,new):

lenth = len(textboxes)

curvalues = [0]*lenth

for i in range(lenth):

	box = textboxes[i]

	curvalues[i] = float(box.value)

source.data = dict(date = source.data.get('date'),price =source.data.get('price') ,profit = curvalues)

for box in textboxes:

box.on_change('value',update_data)

inputs = widgetbox(*textboxes)

curdoc().add_root(row(inputs,Table))

curdoc().title = ‘Fighting!’

interact.py (1.45 KB)

···

On Monday, July 11, 2016 at 1:05:01 PM UTC-5, gl…@hawk.iit.edu wrote:

I have a datatable and would like to make one column editable by the user, so that they can simply click on the desired box, and type in the value. I don’t want the user to be able to edit any other columns. How would I do this?

⌁   Link to post

End of archived discussion · Replies are disabled