Datatables Seamless Notebook

Controls generation of Datatables by the itables library

Table parameters are controlled via ipywidgets

Datatables HTML is displayed directly


In [1]:
import itables  # inserts require.js script/css tags into the Jupyter Notebook web page



In [2]:
import seamless.highlevel
ctx = seamless.highlevel.load_graph("datatables.seamless", zip="datatables.zip")
await ctx.computation()


Seamless buffer cache cleanup is currently disabled.
This prevents data loss from bugs in Seamless's buffer caching.
If you have memory issues, restart Python periodically,
 and/or use Redis to store buffers

In [3]:
from ipywidgets import IntSlider

In [4]:
a_first = IntSlider(min=0,max=10,step=1)
ctx.a_first.traitlet().link(a_first)
a_step = IntSlider(min=0,max=20,step=1)
ctx.a_step.traitlet().link(a_step)
a_first



In [5]:
ctx.a_first.value


Out[5]:
5

In [6]:
o = ctx.datatable.output()
o.output_instance.layout.min_height = "500px"    # Jupyter workaround
o



In [7]:
# A OutputWidget refresh must be triggered manually once when initialization is finished
# For subsequent updates, the table updates correctly already

import asyncio
await asyncio.sleep(1)
o.refresh()


ctx.auto_translate is currently unstable and has been disabled
You must run regularly "ctx.translate()" (IPython) 
or "await ctx.translation()" (Jupyter) after modifying the graph. 
Translation is not required after modifying only cell values

DataTables limitation: every table has a unique ID, so you can display it only once

The following code will give an error

from IPython.display import HTML
HTML(ctx.datatable.value)

or:

o