DataTable does not appear to update when data source is changed

Hi,

I am trying to update a table via a ColumnDataSource

The following code when run with bokeh serve illustrates the issue

from bokeh.layouts import widgetbox

from bokeh.models.sources import ColumnDataSource

from bokeh.models.widgets import DataTable, TableColumn

from bokeh.plotting import curdoc

from tornado import gen

from collections import deque

doc = curdoc()

s = ColumnDataSource(data=dict(thing=[‘sing’] * 5))

@gen.coroutine

def update():

d = s.data[‘thing’]

d.pop(0)

d.append(‘thong’)

s.data = {‘thing’: d}

columns = [

TableColumn(field=“thing”, title=“Thing”)

]

table = DataTable(

source=s, columns=columns, width=100, height=300,

row_headers=False

)

box = widgetbox(table, width=100)

doc.add_root(box)

doc.add_periodic_callback(update, 1000)

``

The table does not begin update until the header row is clicked on.

I also tried streaming.

from bokeh.layouts import widgetbox

from bokeh.models.sources import ColumnDataSource

from bokeh.models.widgets import DataTable, TableColumn

from bokeh.plotting import curdoc

from tornado import gen

doc = curdoc()

s = ColumnDataSource(data=dict(thing=[‘sing’] * 5))

@gen.coroutine

def update():

s.stream({‘thing’: [‘thong’]}, rollover=5)

columns = [

TableColumn(field=“thing”, title=“Thing”)

]

table = DataTable(

source=s, columns=columns, width=100, height=300,

row_headers=False

)

box = widgetbox(table, width=100)

doc.add_root(box)

doc.add_periodic_callback(update, 1000)

``

This generates an exception when the header row is clicked on.

ValueError: Must stream updates to all existing columns (missing: index)

Not sure if I am attempting something unsuported or doing something incorrect.

But the exception suggests there is a problem with the ColumnDataSource indexing.

baldrik

Python version : 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12)

IPython version : 5.1.0

Bokeh version : 0.12.3

Hi,

Seems like there might be some missing plumbing to cause the widget to update. I'd encourage you to file a bug report on GitHUb. Hopefully just a simple fix of adding a missing event hander somewhere.

Thanks,

Bryan

···

On Oct 12, 2016, at 10:29 AM, baldrik <[email protected]> wrote:

Python version : 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12)
IPython version : 5.1.0
Bokeh version : 0.12.3

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/7cc14528-fa18-408c-8264-5c6889007ec8%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

I don’t think so, we
have lots of examples of updating a data table
by changing the data source both with and without server.

                                      A quick look at the code

from the original post and I think the pro blem is that the
individual values
inside the data di ctionary
are being updated instead of
the data property. You can do that , but you need to
call trigger.

···

On 10/21/16 9:31 AM, Bryan Van de Ven
wrote:


Hi,
Seems like there might be some missing plumbing to cause the widget to update. I'd encourage you to file a bug report on GitHUb. Hopefully just a simple fix of adding a missing event hander somewhere.
Thanks,
Bryan

On Oct 12, 2016, at 10:29 AM, baldrik wrote:
Python version : 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12) IPython version : 5.1.0
Bokeh version : 0.12.3
-- You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to .
To post to this group, send email to .
To view this discussion on the web visit .
For more options, visit .


Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)

[email protected][email protected][email protected]https://groups.google.com/a/continuum.io/d/msgid/bokeh/7cc14528-fa18-408c-8264-5c6889007ec8%40continuum.iohttps://groups.google.com/a/continuum.io/d/optout

I don't follow the last statement, the example code does this:

     s.data = {'thing': d}

which is replacing the entire dictionary. If it's failing because some internal bit happens to be the same object as some internal bit of the previous entire dictionary, that seems like a bug. Replacing the entire value should always trigger, IMO.

Thanks,

Bryan

···

On Oct 21, 2016, at 2:53 PM, Sarah Bird - Continuum <[email protected]> wrote:

I don't think so, we have lots of examples of updating a datatable by changing the data source both with and without server.

A quick look at the code from the original post and I think the problem is that the individual values inside the data dictionary are being updated instead of the data property. You can do that, but you need to call trigger.

On 10/21/16 9:31 AM, Bryan Van de Ven wrote:

Hi,

Seems like there might be some missing plumbing to cause the widget to update. I'd encourage you to file a bug report on GitHUb. Hopefully just a simple fix of adding a missing event hander somewhere.

Thanks,

Bryan

On Oct 12, 2016, at 10:29 AM, baldrik <[email protected]> >>> wrote:

Python version : 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12)
IPython version : 5.1.0
Bokeh version : 0.12.3

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
[email protected]
.
To post to this group, send email to
[email protected]
.
To view this discussion on the web visit
https://groups.google.com/a/continuum.io/d/msgid/bokeh/7cc14528-fa18-408c-8264-5c6889007ec8%40continuum.io
.
For more options, visit
https://groups.google.com/a/continuum.io/d/optout
.

--
Sarah Bird
Developer, Bokeh

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/96d002fb-4921-6232-2098-43665e8ca278%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You’re right !
running to quickly here.

···

On 10/21/16 1:38 PM, Bryan Van de Ven
wrote:


	   I don't follow the last statement, the example code does this:
s.data = {'thing': d}
which is replacing the entire dictionary. If it's failing because some internal bit happens to be the same object as some internal bit of the previous entire dictionary, that seems like a bug. Replacing the entire value should always trigger, IMO. Thanks,
Bryan

On Oct 21, 2016, at 2:53 PM, Sarah Bird - Continuum wrote:
I don't think so, we have lots of examples of updating a datatable by changing the data source both with and without server.
A quick look at the code from the original post and I think the problem is that the individual values inside the data dictionary are being updated instead of the data property. You can do that, but you need to call trigger. On 10/21/16 9:31 AM, Bryan Van de Ven wrote:

Hi,
Seems like there might be some missing plumbing to cause the widget to update. I'd encourage you to file a bug report on GitHUb. Hopefully just a simple fix of adding a missing event hander somewhere.
Thanks,
Bryan
 On Oct 12, 2016, at 10:29 AM, baldrik wrote:
Python version : 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12) IPython version : 5.1.0
Bokeh version : 0.12.3
-- You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to .
To post to this group, send email to .
To view this discussion on the web visit .
For more options, visit .




-- Sarah Bird
Developer, Bokeh -- You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to .
To post to this group, send email to .
To view this discussion on the web visit .
For more options, visit .


Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)

[email protected][email protected][email protected]@continuum.iohttps://groups.google.com/a/continuum.io/d/msgid/bokeh/7cc14528-fa18-408c-8264-5c6889007ec8%40continuum.iohttps://groups.google.com/a/continuum.io/d/optout[email protected]@continuum.iohttps://groups.google.com/a/continuum.io/d/msgid/bokeh/96d002fb-4921-6232-2098-43665e8ca278%40continuum.iohttps://groups.google.com/a/continuum.io/d/optout

Hi - Editing datatables with dates

Before editing the date

during

Not exactly the what an end user wants to see when they change dates :slight_smile:

minimally I think the format should follow some human readable from the DateFormatter

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(format='yy-mm-dd')),

    TableColumn(field="downloads", title="Downloads"),

]

data_table = DataTable(source=source, columns=columns, editable=True, width=400, height=280)

show(widgetbox(data_table))

``

btw: Have you seen handsontable? The documentation seems clear and the website is engaging. Open source and licencing model.

···

On Friday, October 21, 2016 at 5:52:17 PM UTC-5, Sarah Bird wrote:

You’re right !
running to quickly here.

  On 10/21/16 1:38 PM, Bryan Van de Ven > wrote:

	   I don't follow the last statement, the example code does this:
s.data = {'thing': d}
which is replacing the entire dictionary. If it's failing because some internal bit happens to be the same object as some internal bit of the previous entire dictionary, that seems like a bug. Replacing the entire value should always trigger, IMO. Thanks,
Bryan
On Oct 21, 2016, at 2:53 PM, Sarah Bird - Continuum <[email protected]> wrote:
I don't think so, we have lots of examples of updating a datatable by changing the data source both with and without server.
A quick look at the code from the original post and I think the problem is that the individual values inside the data dictionary are being updated instead of the data property. You can do that, but you need to call trigger. On 10/21/16 9:31 AM, Bryan Van de Ven wrote:

Hi,
Seems like there might be some missing plumbing to cause the widget to update. I'd encourage you to file a bug report on GitHUb. Hopefully just a simple fix of adding a missing event hander somewhere.
Thanks,
Bryan
On Oct 12, 2016, at 10:29 AM, baldrik <[email protected]> > > > > >  wrote:
Python version : 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12) IPython version : 5.1.0
Bokeh version : 0.12.3
-- You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]
.
To post to this group, send email to [email protected]
.
To view this discussion on the web visit [https://groups.google.com/a/continuum.io/d/msgid/bokeh/7cc14528-fa18-408c-8264-5c6889007ec8%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/7cc14528-fa18-408c-8264-5c6889007ec8%40continuum.io)
.
For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout)
.




-- Sarah Bird
Developer, Bokeh -- You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]
To post to this group, send email to [email protected]
To view this discussion on the web visit [https://groups.google.com/a/continuum.io/d/msgid/bokeh/96d002fb-4921-6232-2098-43665e8ca278%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/96d002fb-4921-6232-2098-43665e8ca278%40continuum.io).
For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).



Sarah Bird
Developer, Bokeh

    [
      <img alt="Continuum Analytics" src="https://lh6.googleusercontent.com/proxy/VYgVjggTk1hCXSN9wFkffE3I6kxTvJ51tT4KvDXOuKbs1WyFG66k7kt2-vkDimbyxfWtP-d1paJmstMYhPPnDYSUF4rLPoYM2GM2QFM=w5000-h5000" style="width:150px;min-height:30px" height="30" width="150">
    ](http://continuum.io)

Having cells be editable was a very recent feature - I’m not sure it
supports dates properly - I certainly didnt’ think to test that when
I reviewed the PR. So I wouldn’t be surprised if you need to open an
issue for this.

···

On 10/22/16 10:12 PM, Itay Livni wrote:

Hi - Editing datatables with dates

            Before

editing the date

during

          Not exactly the what an end user wants to see when they

change dates :slight_smile:

          minimally I think the format should follow some human

readable from the DateFormatter

                    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(format=‘yy-mm-dd’)),

  TableColumn(field="downloads",

title=“Downloads”),

]

                    data_table

= DataTable(source=source, columns=columns,
editable=True, width=400, height=280)

show(widgetbox(data_table))

``

btw: Have you seen handsontable ? The
documentation seems clear and the website is engaging.
Open source and licencing model.

    On Friday, October 21, 2016 at 5:52:17 PM UTC-5, Sarah Bird

wrote:

You’re right! running to quickly
here.

On 10/21/16 1:38 PM, Bryan Van de Ven wrote:


	   I don't follow the last statement, the example code does this:
s.data = {'thing': d}
which is replacing the entire dictionary. If it's failing because some internal bit happens to be the same object as some internal bit of the previous entire dictionary, that seems like a bug. Replacing the entire value should always trigger, IMO. Thanks,
Bryan
On Oct 21, 2016, at 2:53 PM, Sarah Bird - Continuum <[email protected]> wrote:
I don't think so, we have lots of examples of updating a datatable by changing the data source both with and without server.
A quick look at the code from the original post and I think the problem is that the individual values inside the data dictionary are being updated instead of the data property. You can do that, but you need to call trigger. On 10/21/16 9:31 AM, Bryan Van de Ven wrote:

Hi,
Seems like there might be some missing plumbing to cause the widget to update. I'd encourage you to file a bug report on GitHUb. Hopefully just a simple fix of adding a missing event hander somewhere.
Thanks,
Bryan
On Oct 12, 2016, at 10:29 AM, baldrik <[email protected]>
 wrote:
Python version : 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12) IPython version : 5.1.0
Bokeh version : 0.12.3
-- You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]
.
To post to this group, send email to [email protected]
.
To view this discussion on the web visit [https://groups.google.com/a/continuum.io/d/msgid/bokeh/7cc14528-fa18-408c-8264-5c6889007ec8%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/7cc14528-fa18-408c-8264-5c6889007ec8%40continuum.io)
.
For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout)
.




-- Sarah Bird
Developer, Bokeh -- You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]
To post to this group, send email to [email protected]
To view this discussion on the web visit [https://groups.google.com/a/continuum.io/d/msgid/bokeh/96d002fb-4921-6232-2098-43665e8ca278%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/96d002fb-4921-6232-2098-43665e8ca278%40continuum.io).
For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).


Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](https://lh6.googleusercontent.com/proxy/VYgVjggTk1hCXSN9wFkffE3I6kxTvJ51tT4KvDXOuKbs1WyFG66k7kt2-vkDimbyxfWtP-d1paJmstMYhPPnDYSUF4rLPoYM2GM2QFM=w5000-h5000)
    ](http://continuum.io)

– You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]
.
To post to this group, send email to [email protected]
.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/551b8d5e-5f3a-42db-a3ac-064330a95c84%40continuum.io
.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Sarah Bird
Developer, Bokeh


Continuum Analytics