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 some features of DataTables plugin (including Excel export) #398

Closed
wants to merge 5 commits into from

Conversation

hyonaldo
Copy link

Hi. I'm Hyokyun Park.

I needed to download HTML tables on the notebook to my local PC.
So I applied the jquery plugin DataTables (available under the MIT license) to zeppelin-web.
https://www.datatables.net/
I used TableTools extension which is a plug-in for the DataTables for Excel-export feature.

DataTables has most features Sorting(ordering), searcing, paging etc goodness, as shown below.

a

I want to contribute to this project.
Review and comment, please.

@syepes
Copy link

syepes commented Mar 24, 2015

+1 Great contribution!

@anthonycorbacho
Copy link
Contributor

Does it apply to the chart too?
if i filter (search), it should also apply for the chart.

@swkimme
Copy link
Contributor

swkimme commented Mar 24, 2015

Great contribution!

@swkimme
Copy link
Contributor

swkimme commented Mar 24, 2015

Things to consider:
Do we need all of DataTable features?

  1. show limited entries, searching, ordering could be done in SQL
  2. Exporting CSV, Excel could be great! But do we need print, pdf, copy buttons?

May be we can partially adopt DataTable features to keep Zeppelin simple.

@corneadoug
Copy link
Contributor

Maybe we could also do some angular code for once: http://l-lin.github.io/angular-datatables/#/withTableTools

@juhwi
Copy link

juhwi commented Mar 24, 2015

Great contribution!

@julienjtpierre
Copy link

I know some scenarios where the print function would be needed. Would be to have it in there.

@anthonycorbacho
Copy link
Contributor

I would prefer to have on PDF instead of print.
If you need to print the table, you just have to get the pdf and print it.

@julienjtpierre
Copy link

@anthonycorbacho Yes. Is there an export to pdf for charts too? (Little off topic sorry!)

@anthonycorbacho
Copy link
Contributor

@julienjtpierre nope, I guess this PR should introduce this feature since it brings the ability to export.

@hyonaldo
Copy link
Author

@swkimme
Thank you for your comments.

I'm OK with you keeping Zeppelin simple.
Features can be disabled to meet your exact needs as shown below

a

To make use of the buttons above, we simply need to modify the aButtons initialisation option, as shown in the example below.

  // use datatables
  $('#p'+$scope.paragraph.id+'_table .table').DataTable( {
    dom: 'Tt',
    tableTools: {
        "sSwfPath": "images/copy_csv_xls.swf",
        "aButtons": [ "csv", "xls" ]
    },
    lengthChange: false,
    searching: false,
    ordering:  false,
    paging: false
  });

@felixcheung
Copy link
Contributor

+1 for copy (copy to clipboard?)
maybe +1 for pdf

@hyonaldo
Copy link
Author

@anthonycorbacho @julienjtpierre
Hi.
Thanks for your sugegestions.

I wanted some features to download directly from HTML tables of client-side, not from the server-side.
This library (DataTables) meets the requirements.

But zeppelin chart does not come from HTML tables of client-side.
I think another approach is needed to do something related to the chart like Databricks. (such as filtering, exporting PDF... etc)

@hyonaldo
Copy link
Author

@corneadoug
Hi. Thank you for your comments.

I had known about the angular-datatables (http://l-lin.github.io/angular-datatables/#/withTableTools)
But it did not work for me.
I guess "datatables" directive doesn't work in our table tags...
That's why I used the original data-tables library.

@hyonaldo
Copy link
Author

Hi, @felixcheung

Of course, we can.
Using the aButtons parameter we can use any of the options.
See http://datatables.net/extensions/tabletools/buttons

Thanks.

@hyonaldo
Copy link
Author

@swkimme @felixcheung

On second thought, I'd better add +1 copy and +1 pdf.
Since we might need to copy without resizing or scrolling paragraph.

And -1 csv, because it's pretty similar to excel.
https://datatables.net/forums/discussion/14413/when-saving-as-excel-using-excel-button-from-tabletools-csv-option-is-offered

a

What do you think?

@corneadoug
Copy link
Contributor

I think Copy is not needed, Excel neither.

CSV is way better than Excel since everything can read CSV (Excel program also), however not everything can read Excel format.

If such options should be provided, it should be:
CSV -> Download the data in csv format
PDF -> Export what is shown to user (screenshot of visualization basically)

Now, the download Data should probably be the one used by the current visualization (Data transformed by pivot for Charts, Table data without pivot since we don't have pivot function on it)

For the other features of DataTables, It doesn't make sense to restrict it to Table only,
Search feature (filtering) as well as Ordering features for examples should be paragraph based and not visualization based.

I think this kind of feature request should be discussed in the mailing list :)

@swkimme
Copy link
Contributor

swkimme commented Mar 26, 2015

Totally agree with @corneadoug for Copy and CSV.
For copy, we can drag contents of table and just copy by doing ctrl+c, no need of buttons.
(Buttons would be good when contents is large, but in that case, downloading CSV will be a better choice)

ps) This thread is so Hot! Thanks for great contribution again!

@hyonaldo
Copy link
Author

@corneadoug
Thanks for your comments.

I agree with @swkimme that downloading CSV will be a better choice for large tables.
So, I changed the options like below.

"aButtons": [ "csv", "pdf" ]

a

Is there any additional requirements?

@felixcheung
Copy link
Contributor

Sounds good if ctrl-c works well...

@zirho
Copy link

zirho commented Mar 26, 2015

Such a great thing

@akaroice
Copy link

Great contribution!

@seongminwoo
Copy link

I really want this feature! Great contribution! (:-

@anthonycorbacho
Copy link
Contributor

yeah, I aggre with @corneadoug about the pdf part, this must export what the user see.
If the view is set to a graph, then export PDF should export this graph in the pdf (with maybe the table?)

@Leemoonsoo
Copy link
Contributor

@hyonaldo
Thanks for great contribution!

We're now in transition of code base to ASF repo. With some reason, changes in NFLabs/zeppelin will not be automatically transfered to apache/incubator-zeppelin repo since 20/Mar. Could you please re-create your pull request to https://github.com/apache/incubator-zeppelin?

@hyonaldo
Copy link
Author

Hi, @Leemoonsoo

Sure, I would readily accept your proposal.
Did you mean I have to re-fork and re-pull request from https://github.com/apache/incubator-zeppelin ?

@hyonaldo
Copy link
Author

@Leemoonsoo

This conversation has moved to following page.
apache/zeppelin#6

@Leemoonsoo
Copy link
Contributor

@hyonaldo Thanks for recreating the PullRequest.

epahomov pushed a commit to epahomov/zeppelin that referenced this pull request Jul 23, 2016
Prepend ZEPPELIN_CLASSPATH_OVERRIDES environment variable when building CLASSPATH in the shell scripts.

This PR replaces the closed  ZEPL#398 and #386 - Sorry for the mess...

Author: Eric Charles <eric@datalayer.io>

Closes #412 from echarles/ZEPPELIN-383-CLASSPATH_OVERRIDES and squashes the following commits:

8572ec5 [Eric Charles] Use ZEPPELIN_CLASSPATH_OVERRIDES instead of CLASSPATH_OVERRIDES
d63cc55 [Eric Charles] Prepend CLASSPATH_OVERRIDES environment variable when building CLASSPATH in the shell scripts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet