Skip to content
This repository has been archived by the owner on Oct 26, 2019. It is now read-only.

widget don't display after an event (Could not create view Error) #188

Open
madhu-mallisseri opened this issue Apr 18, 2016 · 9 comments
Open
Labels

Comments

@madhu-mallisseri
Copy link

I have a notebook (snippet below) which has an ipywidget button. I need to display a checkbox on click of the button. This works as expected in jupyter. When this notebook is deployed to a dashboard server, on click of button, checkbox is not displayed.

notebook:

from ipywidgets import *
from IPython.display import display

def show_widgets():
    c = widgets.Checkbox(
        description='check me',
        value=True,
    )
    display(c)

button = widgets.Button(
    description='Display checkbox'
)
display(button)

def on_button_clicked(b):
    show_widgets()

button.on_click(on_button_clicked)

JS Console error:

Error: Could not create view at new Error (native) at Error.WrappedError (http://...:3000/components/jupyter-js-widgets.js:4065:22) at promiseRejection (http://...:3000/components/jupyter-js-widgets.js:4156:30)

@parente
Copy link
Member

parente commented Apr 18, 2016

@madhu-mallisseri Can you tell me more about your setup? Are you using the developer docker containers / images in this repo?

@madhu-mallisseri
Copy link
Author

I am using the setup as provided in the "All-in-one" example. https://gist.github.com/parente/527cea0481afe9fabbcd

modified the docker-compose.yml, to remove notebook container.

@parente parente added the bug label Apr 19, 2016
@parente
Copy link
Member

parente commented Apr 19, 2016

Confirmed with the gist. Checking to see if things are better on master. If not, it's quite possible we don't have the right code in place to support ipywidgets dynamically creating other widgets.

@parente
Copy link
Member

parente commented Apr 19, 2016

we don't have the right code in place to support ipywidgets dynamically creating other widgets.

Yep.

https://github.com/jupyter-incubator/dashboards_server/blob/master/public/js/widget-manager.js#L74

We track the initial pending kernel executions to link up the output of a code execution with an output area. But when the code execution is dynamically triggered by an existing widget after initial load, we don't have the source of the execution stashed anywhere in order to put the result into the DOM when it comes back.

@parente
Copy link
Member

parente commented Apr 19, 2016

Here's what the nbextension for ipywidgets does:

https://github.com/ipython/ipywidgets/blob/d3d399188902626a083aadc0f48a9d6c18d8d7e3/widgetsnbextension/src/manager.js#L346

Relies on the notebook and code cell objects as well as the kernel to map message IDs to cells containing widgets. We don't have either so we'll have to invent something new.

@parente
Copy link
Member

parente commented May 23, 2016

Notebook for future ref when we are in a position to tackle this:
https://gist.github.com/parente/767147f18c69794f0cee190b6741a52f

@parente
Copy link
Member

parente commented May 26, 2016

Possibly related, even simpler problem to tackle: ipywidget calls a function, function prints, print output comes in on a regular stream message (not comm), stream message is lost because the widget association is not known.

@tkzeng
Copy link

tkzeng commented Dec 16, 2016

we don't have the right code in place to support ipywidgets dynamically creating other widgets.

@parente Is there a solution for this yet?

@parente
Copy link
Member

parente commented Dec 17, 2016

No and development has stalled.

The dashboard code has to be updated to use newer versions of the jupyterlab + ipywidgets packages before this bug can get tackled. Otherwise, the fix runs the risk of being immediately out of date and irrelevant.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants