Blog

On the DataTables blog you will find news, announcements and tutorials about DataTables and its suite of extensions. New posts are published (usually!) monthly, with additional news items in between.

7th Mar 2023
By Allan Jardine -

Experiment: Import Maps

With ES modules gaining traction throughout the entire Javascript ecosystem, it is natural to want to use them directly in the browser. We can do that through the type="module" attribute for a script, but the browser needs to be able to resolve import names into Javascript files that can be loaded and executed. The importmap script type is the solution to that problem.

For DataTables, we could create a really simple import map like this (note that DataTables has a dependency on jQuery, hence we need to add a resolver for it as well, even if we don't actually write any jQuery code here):

<script type="importmap">
{
    "imports": {
        "jquery": "https://esm.sh/jquery@3.6.3",
        "datatables.net": "https://cdn.datatables.net/1.13.3/js/jquery.dataTables.min.mjs"
    }
}
</script>

Now that the browser has that mapping available, we can import and use DataTables as normal:

<script type="module">
import DataTable from 'datatables.net';

window.addEventListener('DOMContentLoaded',function () {
    new DataTable('#example');
});
</script>

You can see that script and loading here.

The goal in this post is to explore how we might be able to make DataTables easily usable via import maps with DataTables, assessing advantages and limitations of this approach.

Continue reading...

28th Feb 2023
By Allan Jardine -

Loaders for plug-ins

Plug-ins are a very important part of the DataTables eco-system. They expand DataTables' capabilities, wrap common actions into simple functions and provide a way for code to be shared in the community. We store plug-ins developed by ourselves and also those submitted from the community in our plug-ins repo and document them on this site. But to date, there hasn't been much consistency in how the plug-ins are written. With the release of DataTables 1.13.3 today, and the plug-ins repo alongside it, that has now changed.

All plug-ins now:

  • Are formatted by Prettier More (basically Prettier with a few extra options).
  • Provide multiple loader options:
    • ESM
    • CommonJS
    • AMD
    • Browser
  • Provide Typescript definitions for themselves.

Continue reading...

10th Feb 2023
By Allan Jardine -

Editor 2.1

I'm delighted to announce the immediate availability of Editor 2.1 and DataTables 1.13.2.

Editor 2.1 is the cumulation of months of tweaks, features and fixes, and you'll be able to see from its release notes that the changes touch almost every part of the code base. Highlights include:

Continue reading...

Historic blog posts