Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8749029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:37:34+00:00 2026-06-13T12:37:34+00:00

I use datatables on the client to allow speedy live sorting/filtering of around 10,000

  • 0

I use datatables on the client to allow speedy live sorting/filtering of around 10,000 rows of data. It is much faster to supply an array of rows to a DataTable during table creation than to add the rows individually. I can use the onReady function in subscribe to achieve this.
If I then call observe to pick up changes, I get the data already supplied in subscribe again.

While I can hack around this, I presume I am just not using meteor correctly and appreciate any advice.

Here is some sample code:

Meteor.subscribe("books", function(){
    // Runs when subscription is complete
    var mData = Books.find().fetch();

    MyTable = $('#testTable').dataTable( {
        'aoColumns': [
            { sTitle: 'title', sClass: 'alignRight', mDataProp: 'title'},
        ],
        'aaData' : mData
    });
    // Add any new books.
    Books.find().observe({added: function(item){
        // ERR: Adds the books already fetched into mData as well as any new books.
        MyTable.fnAddData([item]);
    }});
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:37:35+00:00Added an answer on June 13, 2026 at 12:37 pm

    There’s a hidden option to observe ({_suppress_initial: true}) that avoids this behaviour. I’m not sure if it’s a good idea to use it, but it is there.

    As for advice around how to structure your code; it’s not as easy as it should be, but I think you want to something like the following:

    1. Wrap your table in a {{#constant}} helper so it never gets re-rendered.

    2. Make sure the table doesn’t get rendered the one-and-only time until the data is ready (this could help: https://github.com/oortcloud/unofficial-meteor-faq#how-do-i-know-when-my-subscription-is-ready-and-not-still-loading)

    3. Do your code above in the table’s Template.table.rendered callback.

    That approach seems more modular.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use jQuery with Datatables to display about 300 database rows. The table is
Not sure if this is possible: I want to use datatables to manipulate my
I want to use the filter function of DataTables, but don't want to use
In my ASP.Net app i use viewstate to store data of a grid, i
For those of you that use the Datatables js plugin, how can I create
I'm attempting to use an ajax source with Datatables, and I've run into some
i use Telerik Demo Sheduler as my base. I have modified data loading like
I am using DataTables plugin to fetch and paginate my table use ajax calls.
I have the following code on the client side for retrieving data from the
Ok so I need to query a live website to get data from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.