Philip
Philip

Reputation: 71

What is the best way to use DataTables with Meteor JS

I've been trying to use DataTables.net, a jquery extension, in my Meteor project.

Specifically when I add DataTables ("meteor npm install --save datatables.net”) to my project I get a console error "bootstrap.js:15Uncaught Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3” which based on what I read says I have jquery twice??? How do I make sure i have one? Then even if I actually try adding datatable, such as:

$(document).ready(function() {
    $('#regulations-table').DataTable();
} );

then I get another console error "jquery.dataTables.js:5854 Uncaught TypeError: Cannot read property 'aDataSort' of undefined"

So again, What's the best way to deploy datatables with Meteor.

Upvotes: 1

Views: 1515

Answers (2)

ghybs
ghybs

Reputation: 53185

If the data you display comes from your MongoDB, a very popular package (with Blaze) is aldeed:tabular.

There are forks and equivalent packages for React as well.

It takes care for you of the subscriptions, pagination and server-side search / filtering.

Upvotes: 1

Mikkel
Mikkel

Reputation: 7777

If you are using Blaze, it would be simple for you to install a package https://atmospherejs.com/ephemer/reactive-datatables

This basically wraps the jquery plugin and makes it easy to integrate.

Upvotes: 0

Related Questions