The sort appears not always to be a stable sort. Stable sorting is actually quite important in a table widget as it is quite common to display data where unique values are defined by the combination of multiple columns. Right now the order appears to be random sometimes. Is this a feature of the underlying table library SlickGrid? I googled around a bit and one of the SlickGrid discussions suggested that the sort was stable but it was a little unclear: https://github.com/mleibman/SlickGrid/issues/9
An example screenshot is below. Note the ABBA order of the first 4 rows. It should be ABAB.
To reproduce the problem run the following code in an ipython notebook and then click on column A, then column B. If you don’t see the problem try A and then B again. After 1,2 or 3 tries it almost always happens.
from bokeh import models, plotting, widgets
j = 10
df = pandas.DataFrame(dict(A=[‘A’]*j + [‘B’]*j, B=[i for i in range(j)]*2))
source = models.ColumnDataSource(df)
columns = [
widgets.TableColumn(field=c, title=c) for c in df.columns
data_table = widgets.DataTable(source=source, columns=columns, editable=True, width=1000)
I’m using bokeh ‘0.7.1.dev.20150109’ and Chrome Version 39.0.2171.71