Skip to content

DataTable selectable='checkbox' gives JavaScript error #8050

Closed
@markusdr

Description

@markusdr

ALL software version info (bokeh, python, notebook, OS, browser, any other relevant packages)

bokeh 0.13.0
python 3.6.5
Mac OS Sierra 10.12.6
Got same JavaScript error in:
Chrome Version 67.0.3396.87 (Official Build) (64-bit) and
Safari Version 11.1.1 (12605.2.8)

Description of expected behavior and the observed behavior

It should show a DataTable with checkboxes for row selection, as described in the DataTable help:

selectable = Either(Bool(True), Enum("checkbox"), help="""
    Whether a table's rows can be selected or not. Using ``checkbox`` is
    equivalent  to ``True``, but makes selection visible through a checkbox
    for each row,  instead of highlighting rows. Multiple selection is
    allowed and can be achieved by either clicking multiple checkboxes (if
    enabled) or using Shift + click on rows.

But nothing is shown, and a JavaScript error occurs, see below.

Complete, minimal, self-contained example code that reproduces the issue

from datetime import date
from random import randint

from bokeh.io import output_file, show
from bokeh.layouts import widgetbox
from bokeh.models import ColumnDataSource
from bokeh.models.widgets import DataTable, DateFormatter, TableColumn

output_file("data_table.html")

data = dict(
            dates=[date(2014, 3, i+1) for i in range(10)],
            downloads=[randint(0, 100) for i in range(10)],
        )
source = ColumnDataSource(data)

columns = [
            TableColumn(field="dates", title="Date", formatter=DateFormatter()),
            TableColumn(field="downloads", title="Downloads"),
        ]
data_table = DataTable(source=source, columns=columns, width=400, height=280, selectable='checkbox')

show(widgetbox(data_table))

Stack traceback and/or browser JavaScript console output

Uncaught Error: Bool property 'selectable' given invalid value: "checkbox"
    at e.validate (bokeh-0.13.0.min.js:31)
    at e.t._init (bokeh-0.13.0.min.js:31)
    at e.t.update (bokeh-0.13.0.min.js:31)
    at e.u.finalize (bokeh-0.13.0.min.js:31)
    at bokeh-0.13.0.min.js:31
    at _ (bokeh-0.13.0.min.js:31)
    at _ (bokeh-0.13.0.min.js:31)
    at Function.P._initialize_references_json (bokeh-0.13.0.min.js:31)
    at Function.P.from_json (bokeh-0.13.0.min.js:31)
    at bokeh-0.13.0.min.js:31

Screenshots or screencasts of the bug in action

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions