Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[Feature Request] Option to collapse DataTable rows #8100
I don't really understand the use case or requirements. In particular, existing Bokeh data sources are, to my mind anyway, fundamentally not hierarchical. So what exactly does it mean to adapt them into a collapsible (i.e. tree-style) layout? Alternatively are you proposing an entirely new data structure?
So for there to be any chance of movement on this, someone will have to put together a much more thorough proposal:
@lgasnier are you able to work up a real proposal? If not we will have to close this as too underspecified.
Sorry, my request is too brief and not obvious.
My concrete use case is the following. I have an ecological status that depends on:
With this tree data structure, I made a
When I saw the thread mentioned above, I thought DataTable could be the right widget for my use case with some enhancements. But I don’t know if it represents a lot of work ;-)
So below is what I came up with.
New attributes proposed to TableColumn class
If a column has children (ie, tuple[-1] is None), add a mark to manage accordion (to collapse/expand the rows of the datatable). To collapse children rows of a parent, these children rows would be filtered according to the tuple content of the column values.
Dummy script example
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( name=[("John", None, None), ("John", "Thomas", None), ("John", "Thomas", "Joe"), ("John", "Thomas", "Ken"), ("John", "James", None), ("John", "James", "Pat"), ("George", None, None), ("George", "Martin", None), ("George", "Martin", "Emily"), ("George", "Andrew", None), ("George", "Andrew", "Ron")], age=[70, 40, 10, 15, 30, 8, 65, 35, 15, 40, 18], expanded=[True, True, False, False, False, False, True, True, True, True, True], ) source = ColumnDataSource(data) columns = [ TableColumn(field="name", title="Children, fathers and grandfathers", accordion=True, expand_field="expanded", offset="10px", expand_mark="►", collapse_mark="▼"), TableColumn(field="age", title="Age"), ] data_table = DataTable(source=source, columns=columns, width=400, height=280) show(widgetbox(data_table))
Is it enough to take into account this feature request? Do you need some more descriptions?
Thanks for the additional details @lgasnier With that detail I can see that something like that might be possible and useful.
But I should be up front about expectations re: timing. This is probably not something that can be addressed by the small core team in the very near future. The DataTable is already one of the most complicated widgets, and it has several current regressions due to a lapse in our automated testing. We need to get it back in reasonable shape before adding more complexity to it. I am working on fixing our testing infra which is itself a large task, then going to get the current DataTable stable under test. The other thread of work now is a final clean up of layout. Those are the priorities for an upcoming 1.0 release. Since this issue describes a new feature without breaking API, it definitely won't come before the 1.0 which is a few months away.