Skip to content

[WIP] Allow to show a table in the IPython notebook using dataTables. - #4197

Merged
eteq merged 5 commits into
astropy:masterfrom
saimn:jsviewer-ipynb
Oct 7, 2015
Merged

eteq merged 5 commits into
astropy:masterfrom
saimn:jsviewer-ipynb

Conversation

@saimn

@saimn saimn commented Sep 28, 2015

Copy link
Copy Markdown
Contributor

This feature existed but was broken (#3937 (comment)). cc @taldcroft @keflavich
Here a new method show_in_notebook is added (it could replace the _repr_html but it is probably safer to use a separate method for now).
The dataTables js file is loaded with requirejs, and a lightweight css style is added using Bootstrap. About the CSS:

  • we could use directly the notebook's one but it is not very pretty,
  • here I use Bootstrap which is already available in the notebook, so I need to add classes to the HTML table which I do with a ugly .replace, it would be cleaner with Allow to specify CSS classes for Table.pformat #4131 (done).
  • it could also be possible to use the dataTables CSS, but it requires one more external download and it seems not necessary.

ipynb

@keflavich

Copy link
Copy Markdown
Contributor

Looks neat. Are there any weird interactions with ipython's mapping of keyboard commands/shortcuts? I vaguely remember having some issues with that.

@saimn

saimn commented Oct 2, 2015

Copy link
Copy Markdown
Contributor Author

Rebased and updated to use #4131

@keflavich It doesn't seem that dataTables binds some keyboard event by default, and I didn't find something about this.

@astrofrog

Copy link
Copy Markdown
Member

@saimn - can you rebase and move the changelog entry in the 1.2 section? (sorry that this didn't get merged in time for 1.1!)

saimn added 4 commits October 7, 2015 00:00
This feature existed but was broken
(astropy#3937 (comment)).
Here a new method `show_in_notebook` is added to render a table. The dataTables
js file is loaded with requirejs, and a lightweight css style is added using
Bootstrap (already available in the notebook).
@saimn

saimn commented Oct 7, 2015

Copy link
Copy Markdown
Contributor Author

@astrofrog done.

@eteq
eteq merged commit 27d14fa into astropy:master Oct 7, 2015
eteq added a commit that referenced this pull request Oct 7, 2015
Add method to show tables with dataTables in notebook
@eteq

eteq commented Oct 7, 2015

Copy link
Copy Markdown
Member

@saimn - because this is actually a fix in that it reactivated a feature that previously existed, we decided it was ok to treat this as a bug fix and merge it for 1.1 (I updated the changelog in the manual merge).

Thanks!

@eteq eteq added this to the v1.1.0 milestone Oct 7, 2015
@eteq eteq added the Bug label Oct 7, 2015
@saimn

saimn commented Oct 7, 2015

Copy link
Copy Markdown
Contributor Author

Great :-), thanks @eteq !

@saimn
saimn deleted the jsviewer-ipynb branch October 8, 2015 07:12
eteq added a commit that referenced this pull request Oct 12, 2015
Add method to show tables with dataTables in notebook
@eteq

eteq commented Oct 12, 2015

Copy link
Copy Markdown
Member

backported to v1.1.x in 9889c77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants