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 support for the datatables.net extensions like e.g. "buttons" #50

Closed
mwouts opened this issue Jan 10, 2022 · 6 comments · Fixed by #235
Closed

Add support for the datatables.net extensions like e.g. "buttons" #50

mwouts opened this issue Jan 10, 2022 · 6 comments · Fixed by #235

Comments

@mwouts
Copy link
Owner

mwouts commented Jan 10, 2022

Can we add support for some extensions like buttons? See #18 for a first attempt.

@rikturr
Copy link

rikturr commented Apr 26, 2022

Hello! First, I'd like to say THANK YOU for making this package! I always loved using DT in R, and just today found itables and its worked like a charm out of the box. I'm going to share it with my whole data team this week.

I'm eager to see buttons supported as well, so just wanted to offer any help if you need it. I noticed #67 is very active so you may have it covered already. At least the wanted to say hi and thank you :)

@mwouts
Copy link
Owner Author

mwouts commented May 9, 2022

Hi @rikturr , thank you for your kind and supportive message! Yes when we can add buttons to this package we'll reach a great milestone. As you saw at #67 that is still a work in progress - in that PR I am trying to adapt @qqdaiyu55's approach from that comment to make it more generic, but we're not done yet!

@mwouts
Copy link
Owner Author

mwouts commented Nov 13, 2022

The latest release of datatables.net==1.13.1 will let us load the buttons using ESM imports.

One example is given at https://datatables.net/forums/discussion/74578 and looks like this:

import JSZip from 'jszip';
import pdfMake from 'pdfmake';
import pdfFonts from 'pdfmake/build/vfs_fonts';
import DataTable from 'datatables.net-bs5';
import 'datatables.net-buttons-bs5';
import 'datatables.net-buttons/js/buttons.html5';
 
DataTable.Buttons.jszip(JSZip);
DataTable.Buttons.pdfMake(pdfMake);
 
pdfMake.vfs = pdfFonts.pdfMake.vfs;
 
new DataTable('#example', {
    dom: 'Bftip',
    buttons: [
        'excel',
        'pdf'
    ]
});

In the context of Jupyter we need to load all these libraries from a CDN. That means that we will have to find out how to write the import map for the above example.

@allan, is it already possible to infer the import map from https://datatables.net/download/index? Do you have any advice on how to write the import map for this example? Thank you so much!

@bryanwhiting
Copy link

Is there any hacky way I can use buttons? e.g., download the .js file and import it?

(I'm also a DT R user and was pleased to see itables in progress! keep up the good work!)

@mwouts mwouts mentioned this issue Mar 5, 2024
7 tasks
@mwouts
Copy link
Owner Author

mwouts commented Mar 16, 2024

Buttons are supported in itables==2.0.0! And many other extensions too 😄
See the examples at https://mwouts.github.io/itables/extensions.html

@bryanwhiting
Copy link

Incredible. Absolutely incredible.

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

Successfully merging a pull request may close this issue.

3 participants