Closed mwouts closed 5 months ago
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 :)
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!
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!
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!)
Buttons are supported in itables==2.0.0
! And many other extensions too :smile:
See the examples at https://mwouts.github.io/itables/extensions.html
Incredible. Absolutely incredible.
Can we add support for some extensions like buttons? See #18 for a first attempt.