Is there a way to hide DataTable title?

Hi bokeh community,

Here is my case: I created a DataTable to only show one number. And I use a select tool to control the value that is showing in the table. Below is the MRC.


import pandas as pd
import numpy as np
from bokeh.models import ColumnDataSource, TableColumn, DataTable,HTMLTemplateFormatter, Select, CustomJS
from bokeh.plotting import figure, output_notebook, show
from bokeh.layouts import row, column
output_notebook()

t = pd.DataFrame(np.array([[100,40,50]]),columns=['A','B','C'])

t_source = ColumnDataSource(t)

template1="""<div style="font-size: 36px; color: lightslategray; font-weight: bold; padding-top: 0px; border: 0px; line-height: 75px;"> <%= value %> </div>"""

cols1 = TableColumn(field='A', width=50, formatter=HTMLTemplateFormatter(template=template1), sortable=False, title=None)
data_table1 = DataTable(source=t_source, columns=[cols1], height = 150, width = 150, row_height=75, index_position=None)

#JS select dropdown box callback
stage_menu = ["A","B","C"]
select = Select(value = 'A', options=stage_menu, width=150)

code = '''         
         //callbacks for data_table1      
         cols1.field = select.value
         cols1.change.emit()
         data_table1.change.emit()
       '''
select_cb = CustomJS(args=dict(cols1=cols1,data_table1=data_table1,select=select),code=code)
select.js_on_change('value', select_cb)

show(column(select,data_table1))

image

Is there a way to hide the table title? Like the ‘C’ showing in the screenshot. I tried different ways. even set title=‘’ which will make title text gone but still shows a white block when your mouse over it.

Thanks for your help!!!

Hi @saiyasaibing please edit your post to use code formatting so that the code is intelligible (either with the </> icon on the editing toolbar, or triple backtick ``` fences around the code blocks)

Hi Bryan,

Thanks for reminding. I just edited my original post.

Thanks,
Saiyasaibing

@saiyasaibing That appears to be the header row. If you want to turn that off set header_row=False on the table.

https://docs.bokeh.org/en/latest/docs/reference/models/widgets/tables.html?highlight=datatable#bokeh.models.DataTable.header_row

Looks like I can’t use selectable=False and header_row=False at the same time.

After remove selectable=False, now header_row=False is working properly.

Thank you @Bryan Bryan

That’s surprising, what exactly do you see when try that combination?

When I am doing combination of selectable=False and header_row=False, header_row=False doesn’t do anything. The header is still showing.

That seems like a bug, then. Please file a GitHub Issue with a complete Minimal Reproducible Example.