Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add export and column visibility buttons to tables #363

Merged
merged 9 commits into from
Oct 8, 2020

Conversation

ajstewart
Copy link
Contributor

@ajstewart ajstewart commented Sep 30, 2020

Uses the Datatables buttons extension.

The dom was defined using the solution presented here: https://stackoverflow.com/questions/32252616/datatable-styling-so-bootstrap-button-appears-on-same-row-as-other-elements.

Excel will work when Datatables buttons makes a new release, see DataTables/Buttons#182.

This PR is based from #345 so will wait for that one to be done.

Some screenshots:

Screen Shot 2020-09-30 at 19 08 55

Screen Shot 2020-09-30 at 19 09 08

CSV exported from above:

"ID","Name","Date (UTC)","Image","Frequency (MHz)","RA (deg)","RA Error (arcsec)","Dec (deg)","Dec Error (arcsec)","Int. Flux (mJy)","Int. Flux Error (mJy)","Peak Flux (mJy/beam)","Peak Flux Error (mJy/beam)","Local RMS (mJy)","SNR","Has siblings","Forced Extraction","Image ID"
"989","VAST_0127-73A_SB9673_component_1760a","2019-08-28T15:40:16.445000+00:00","VAST_0127-73A.EPOCH01.I.fits","887.00","6.9236","1.8997","-75.2131","1.3113","7.433","2.129","5.434","0.991","0.94","5.81","false","false","1"
"11663","VAST_0127-73A_SB11608_component_5441a_f20200930T0540","2020-01-26T08:40:45.484000+00:00","VAST_0127-73A.EPOCH08.I.fits","887.00","6.9236","0.0100","-75.2131","0.0100","3.796","1.536","3.796","1.536","1.54","2.47","false","true","2"

Also reduces the pagination control numbers on the external results table to avoid overlap.

Fixes #360.

p.s. I couldn't work out how to ungroup the buttons, but the look grew on me.

@ajstewart ajstewart added the enhancement New feature or request label Sep 30, 2020
@ajstewart ajstewart added this to the Collaboration beta release milestone Sep 30, 2020
@ajstewart
Copy link
Contributor Author

To note here that as nearly all the tables are server side these export buttons export what is currently on the page.

I more see this as a convenience so I don't think we need to write our own fetching function to get all rows, especially as it could be nearly a million rows in some cases. Though the only place I see this as a problem is the sources query but I would rather direct users to the Jupyter Hub.

Base automatically changed from website-improvments to master October 1, 2020 15:13
* Added datatables-buttons extension.
* Added jszip node dependency (for excel export).
* Added Export to CSV and Excel buttons to tables.
* Added Column visibility button.
* Changed external search results page numbers.
* Updated datatables to 1.10.22.
@ajstewart ajstewart force-pushed the issue-360-add-tables-csv-export branch from 54dc9ee to 4c4beee Compare October 1, 2020 15:22
@ajstewart ajstewart marked this pull request as ready for review October 1, 2020 15:23
@ajstewart ajstewart requested review from srggrs and marxide October 1, 2020 15:23
@ajstewart
Copy link
Contributor Author

This can now be reviewed.

Only change will be waiting for a Datatables-buttons release to fix the Excel export (if you want to test it the solution is in that linked issue). They say it's imminent...

@ajstewart ajstewart self-assigned this Oct 1, 2020
CHANGELOG.md Outdated
Comment on lines 18 to 21
- Added csv and excel export buttons to datatables on webinterface [#363](https://github.com/askap-vast/vast-pipeline/pull/363).
- Added column visibility button to datatables on webinterface [#363](https://github.com/askap-vast/vast-pipeline/pull/363).
- Added dependancy datatables-buttons 1.6.4 [#363](https://github.com/askap-vast/vast-pipeline/pull/363).
- Added dependancy jszip (required for Excel export) [#363](https://github.com/askap-vast/vast-pipeline/pull/363).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move at the top of the list

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gah, fixed in be4f81c.

@ajstewart ajstewart requested review from marxide and srggrs October 3, 2020 01:57
marxide
marxide previously approved these changes Oct 5, 2020
@ajstewart ajstewart requested a review from marxide October 6, 2020 02:40
marxide
marxide previously approved these changes Oct 7, 2020
@ajstewart ajstewart merged commit 606e161 into master Oct 8, 2020
@ajstewart ajstewart deleted the issue-360-add-tables-csv-export branch October 8, 2020 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export to CSV buttons on tables
3 participants