What's the trick to updating the rows in a table?

We used to have this working, but something changed over the past couple of months and we now can’t seem to be able to update the rows in a table ( bokeh version: 0.12.0dev1 running in a notebook).

The attached example notebook is a simple test case that first creates and displays a table. It then changes the source for the table and calls push_notebook, but nothing happens. However if we show the table again it does reflect the changes in the new copy.

I’m sure it’s probably something obvious but can’t seem to figure out what I’m missing or doing wrong. Is there some trick to updating the contents of a table after it’s been shown in a notebook?

table_update_test.ipynb (20.2 KB)

Jim,

There are two things. One is that it the data table is not added to the "current document" automatically the way it happens with "figure", "vplot", etc. This part of the API is a bit muddled, and we are currently working on making it better. In the mean time, the upshot is just that you need to add the table to the document explicitly:

  curdoc().add_root(bokehTable)

The other like the plumbing to change .source is not hooked up completely, but changing source.data is, so use:

  bokehTable.source.data = {'AAA' : [8, 9, 10, 11], 'BBB' : [11, 21, 31, 41],'CCC' : [201,51,-31,-51]}

Or or the equivalent, basically: update the existing source, don't replace it.

With these changes, I see the table update.

Thanks,

Bryan

···

On May 6, 2016, at 6:02 PM, Jim Sharpe <[email protected]> wrote:

We used to have this working, but something changed over the past couple of months and we now can't seem to be able to update the rows in a table ( bokeh version: 0.12.0dev1 running in a notebook).

The attached example notebook is a simple test case that first creates and displays a table. It then changes the source for the table and calls push_notebook, but nothing happens. However if we show the table again it does reflect the changes in the new copy.

I'm sure it's probably something obvious but can't seem to figure out what I'm missing or doing wrong. Is there some trick to updating the contents of a table after it's been shown in a notebook?

--
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/f76ad540-2a17-4a80-91f4-c5e70f0bef82%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
<table_update_test.ipynb>

As a corollary, can you make a GH issue with all this info so we can track the "replace the source" case and schedule work to fix it at some point. That would be very helpful!

Thanks,

Bryan

···

On May 7, 2016, at 12:07 PM, Bryan Van de Ven <[email protected]> wrote:

Jim,

There are two things. One is that it the data table is not added to the "current document" automatically the way it happens with "figure", "vplot", etc. This part of the API is a bit muddled, and we are currently working on making it better. In the mean time, the upshot is just that you need to add the table to the document explicitly:

  curdoc().add_root(bokehTable)

The other like the plumbing to change .source is not hooked up completely, but changing source.data is, so use:

  bokehTable.source.data = {'AAA' : [8, 9, 10, 11], 'BBB' : [11, 21, 31, 41],'CCC' : [201,51,-31,-51]}

Or or the equivalent, basically: update the existing source, don't replace it.

With these changes, I see the table update.

Thanks,

Bryan

On May 6, 2016, at 6:02 PM, Jim Sharpe <[email protected]> wrote:

We used to have this working, but something changed over the past couple of months and we now can't seem to be able to update the rows in a table ( bokeh version: 0.12.0dev1 running in a notebook).

The attached example notebook is a simple test case that first creates and displays a table. It then changes the source for the table and calls push_notebook, but nothing happens. However if we show the table again it does reflect the changes in the new copy.

I'm sure it's probably something obvious but can't seem to figure out what I'm missing or doing wrong. Is there some trick to updating the contents of a table after it's been shown in a notebook?

--
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/f76ad540-2a17-4a80-91f4-c5e70f0bef82%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
<table_update_test.ipynb>

Hi Bryan,

Thanks for the very prompt reply. After reading your solution I do now recall the need to set source.data directly rather than just changing the source. And had actually tried that, which is why that commented out line was in the example notebook. The part I was missing was registering the table with curdoc.

A while back I opened GH issue #3564 about getting a selected row after a column sort. It appears that overall topic might actually be the same as this one in that it’s related to source handling for tables. Do you think that’s the case or should I still open a new issue?

···

On Saturday, May 7, 2016 at 5:07:17 AM UTC-6, Bryan Van de ven wrote:

Jim,

There are two things. One is that it the data table is not added to the “current document” automatically the way it happens with “figure”, “vplot”, etc. This part of the API is a bit muddled, and we are currently working on making it better. In the mean time, the upshot is just that you need to add the table to the document explicitly:

    curdoc().add_root(bokehTable)

The other like the plumbing to change .source is not hooked up completely, but changing source.data is, so use:

    bokehTable.source.data = {'AAA' : [8, 9, 10, 11], 'BBB' : [11, 21, 31, 41],'CCC' : [201,51,-31,-51]}

Or or the equivalent, basically: update the existing source, don’t replace it.

With these changes, I see the table update.

Thanks,

Bryan

On May 6, 2016, at 6:02 PM, Jim Sharpe [email protected] wrote:

We used to have this working, but something changed over the past couple of months and we now can’t seem to be able to update the rows in a table ( bokeh version: 0.12.0dev1 running in a notebook).

The attached example notebook is a simple test case that first creates and displays a table. It then changes the source for the table and calls push_notebook, but nothing happens. However if we show the table again it does reflect the changes in the new copy.

I’m sure it’s probably something obvious but can’t seem to figure out what I’m missing or doing wrong. Is there some trick to updating the contents of a table after it’s been shown in a notebook?


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/f76ad540-2a17-4a80-91f4-c5e70f0bef82%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

<table_update_test.ipynb>

From a quick re-look at that, I think this is a separate issue.

Bryan

···

On May 7, 2016, at 2:37 PM, Jim Sharpe <[email protected]> wrote:

Hi Bryan,

Thanks for the very prompt reply. After reading your solution I do now recall the need to set source.data directly rather than just changing the source. And had actually tried that, which is why that commented out line was in the example notebook. The part I was missing was registering the table with curdoc.

A while back I opened GH issue #3564 about getting a selected row after a column sort. It appears that overall topic might actually be the same as this one in that it's related to source handling for tables. Do you think that's the case or should I still open a new issue?

On Saturday, May 7, 2016 at 5:07:17 AM UTC-6, Bryan Van de ven wrote:
Jim,

There are two things. One is that it the data table is not added to the "current document" automatically the way it happens with "figure", "vplot", etc. This part of the API is a bit muddled, and we are currently working on making it better. In the mean time, the upshot is just that you need to add the table to the document explicitly:

        curdoc().add_root(bokehTable)

The other like the plumbing to change .source is not hooked up completely, but changing source.data is, so use:

        bokehTable.source.data = {'AAA' : [8, 9, 10, 11], 'BBB' : [11, 21, 31, 41],'CCC' : [201,51,-31,-51]}

Or or the equivalent, basically: update the existing source, don't replace it.

With these changes, I see the table update.

Thanks,

Bryan

> On May 6, 2016, at 6:02 PM, Jim Sharpe <[email protected]> wrote:
>
> We used to have this working, but something changed over the past couple of months and we now can't seem to be able to update the rows in a table ( bokeh version: 0.12.0dev1 running in a notebook).
>
> The attached example notebook is a simple test case that first creates and displays a table. It then changes the source for the table and calls push_notebook, but nothing happens. However if we show the table again it does reflect the changes in the new copy.
>
> I'm sure it's probably something obvious but can't seem to figure out what I'm missing or doing wrong. Is there some trick to updating the contents of a table after it's been shown in a notebook?
>
>
> --
> 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/f76ad540-2a17-4a80-91f4-c5e70f0bef82%40continuum.io.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout.
> <table_update_test.ipynb>

--
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/e42788ea-3078-4aba-8268-c46c6fa4df8c%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

issue #4294 has been created for tracking

···

On Saturday, May 7, 2016 at 5:11:14 AM UTC-6, Bryan Van de ven wrote:

As a corollary, can you make a GH issue with all this info so we can track the “replace the source” case and schedule work to fix it at some point. That would be very helpful!

Thanks,

Bryan

On May 7, 2016, at 12:07 PM, Bryan Van de Ven [email protected] wrote:

Jim,

There are two things. One is that it the data table is not added to the “current document” automatically the way it happens with “figure”, “vplot”, etc. This part of the API is a bit muddled, and we are currently working on making it better. In the mean time, the upshot is just that you need to add the table to the document explicitly:

    curdoc().add_root(bokehTable)

The other like the plumbing to change .source is not hooked up completely, but changing source.data is, so use:

    bokehTable.source.data = {'AAA' : [8, 9, 10, 11], 'BBB' : [11, 21, 31, 41],'CCC' : [201,51,-31,-51]}

Or or the equivalent, basically: update the existing source, don’t replace it.

With these changes, I see the table update.

Thanks,

Bryan

On May 6, 2016, at 6:02 PM, Jim Sharpe [email protected] wrote:

We used to have this working, but something changed over the past couple of months and we now can’t seem to be able to update the rows in a table ( bokeh version: 0.12.0dev1 running in a notebook).

The attached example notebook is a simple test case that first creates and displays a table. It then changes the source for the table and calls push_notebook, but nothing happens. However if we show the table again it does reflect the changes in the new copy.

I’m sure it’s probably something obvious but can’t seem to figure out what I’m missing or doing wrong. Is there some trick to updating the contents of a table after it’s been shown in a notebook?


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/f76ad540-2a17-4a80-91f4-c5e70f0bef82%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

<table_update_test.ipynb>