Speeding up datatables when retrieving data from indexedDB

Speeding up datatables when retrieving data from indexedDB

gaurav1gaurav1 Posts: 3Questions: 0Answers: 0
edited February 2014 in DataTables 1.9
I am using datatablejs on client side for displaying the database to client. I download the database from server initially using backbone indexeddb adapter and store it in indexedDB so as to support offline access to data. However, datatables take approx around 5 minutes to render 20,000 entries from indexedDB. This is my JS code:
http://jsfiddle.net/mPyH5/

I have tried using methods listed here: http://datatables.net/faqs#speed but none of them works. I have also tried using infinite scrolling. It doesn't reduce time. Can anybody suggest a way to make the list page load faster?

Replies

  • allanallan Posts: 63,488Questions: 1Answers: 10,467 Site admin
    Are you using server-side processing? If not, I'd suggest you do!

    Allan
  • gaurav1gaurav1 Posts: 3Questions: 0Answers: 0
    In that case, offline access will not be possible. I want user to see all of the database even when he is offline. That is the sole purpose of the website.
  • allanallan Posts: 63,488Questions: 1Answers: 10,467 Site admin
    If you are using a local database, don't roundtrip it into the DOM - that just means you are writing to the DOM and then DataTables reading it back from the DOM, which is horribly slow.

    If you have the data available, just feed it to DataTables using aaData as native Javascript arrays or objects and enable deferred rendering ( bDeferRender ). Then the slowest part will be reading the data from the database.

    Allan
  • gaurav1gaurav1 Posts: 3Questions: 0Answers: 0
    Writing in DOM took only 1% of the total time. Rest 99% was taken by Datatables to read. Anyway I'll try your suggestion and see how much of the time I was able to reduce. Thanks for suggesting.
  • allanallan Posts: 63,488Questions: 1Answers: 10,467 Site admin
    Yup - reading from the DOM is a horribly slow process. There isn't a huge amount I can do about that unfortunately! DataTables 1.10 does have some performance improvements, so if you aren't using the beta yet, try that, but I think (hope) you will be impressed with the performance if you don't round-trip your data through the DOM.

    Allan
  • maheemahee Posts: 10Questions: 4Answers: 0

    what will be the server side script to get data from indexedDB.
    I mean how code will look like.
    can any one please suggest?

This discussion has been closed.