Populating a DataTable

Populating a DataTable

abuk13abuk13 Posts: 1Questions: 0Answers: 0
edited February 2013 in General
I am trying to populate a datatable from my database with php/mysql. All is well it works but it is really slow.
If I limit the rows in the query it is great.
I don't have much knowledge of javascript, and was just wondering if someone could help me out. Is it possible to limit on page load, add a button for next page that will requery and repopulate without page loading again?
I'm only trying to retrieve 2000 rows, if there is another way to speed things up, your help would be much appreciated.

Oh, I also want to be able to use the sorting and search facility so ideally the whole database has to be loaded...

Replies

  • bozdenbozden Posts: 10Questions: 0Answers: 0
    I have 1 M records in my transportation schedule table. The only way I could figure out is to use a cascaded menu to specify two columns (in my case fromport, toport) , so that the number of records are smaller.

    Alternatively you can add html buttons to show first 1000, second 1000 or so, using GET method connected with the page and using the "LIMIT row, rows" part of the SELECT query. Same can be done with a SELECT and JavaScript "onchange".

    But you will never sort/filter all data with these records.
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    With server-side processing, you should be able to use many millions of rows. Indeed, I've seen DataTables which use 20 million+ rows.

    @abuk13 - How are you loading the data? HTML or Ajax or Ajax + server-side processing? I'd suggest Ajax with deferred rendering enabled for just 2000 records.

    Allan
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Also see: http://datatables.net/faqs#speed
This discussion has been closed.