Using jQuery DataTables with Aurelia

This is assuming you have an Aurelia project set up and just want to add jQuery DataTables.

First, use jspm to grab datatables.

jspm install datatables=npm:datatables

When that’s done, you can start using it on a table in a view/viewmodel.

import $ from 'jquery';
import dataTable from 'datatables';

export class DataTableViewModel { 
  activate() {
      //bind your data here
  attached() {
      $('.js-table').dataTable( {
        "paginate": true,
        "pageLength": 25

There might be a better way to do this, but this works for now. I mostly based this on this excellent post about Toastr and Aurelia

One Reply to “Using jQuery DataTables with Aurelia”

  1. worked like a champ, thanks for the posting, just one minor tweak, need to make sure and npm install –save, I am using webpack if that makes a difference

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.