jQuery DataTables

Hi all,

I’ve decided to forgo aldeed:tabular and aslagle:reactive-table because they are extremely slow for some reason (maybe because I have 3000 rows). Instead I am trying to use this: https://datatables.net/manual/installation

I also did
meteor add jquery
and
npm install datatables.net

The installation section says I need to put this code somewhere:

 $(document).ready( function () {
    $('#table_id').DataTable();
} );

When I put it in my main js file (which has my template helpers), I get this error:

(STDERR) ReferenceError: $ is not defined

Does anyone have any experience with setting up jQuery to help with this error? Thanks.

Before heading down this path, just a quick heads up - aldeed:tabular is basically a wrapper around DataTables. If you’re experiencing performance problems with Tabular, chances are you’re going to see the same thing with DataTables. You’ll also be looking at re-implementing a lot of the work Tabular already takes care of, when it comes to handling subscriptions and reactivity.

The above being said, what kind of performance problems are you seeing? Have you looked into integrating meteorhacks:subs-manager to help speed things up?

This failure comes from the fact that datatables uses a different Jquery version then meteor and therefore those jquery’s interfere eacht other.

A workaround would be: use https://api.jquery.com/jquery.noconflict/ to overcome this problem (needs to be setup everytime when a new site loads)

Hi @hwillson, it’s stuck on “processing” the whole time and often crashes the browser. I actually got Datatables setup, and it’s the same speed as if I had a normal HTML table!! It also seems easier because I can keep my Blaze template logic (e.g. {{#if RegisteredAt}} YES {{/if}}).

But now I’m stuck with the fact that if I try searching for something, all the data disappears. Do you know how to prevent that?