Data Loading
Data Loading
How do I implement DataTables that uses infinite scrolling (or scroller) where all the data is NOT loaded when the table is initialized using DOM data?I have tried all the tips and documentation from the site on using scroller but still all my data if loaded upfront before scroller takes effect but it is really lagging and loads forever.I have 15000 records client side processing.
This is how currently my page looks like: http://debug.datatables.net/ikoxes and it does not show the scroller and also takes alot of time to load.Is there a way to limit the initial data being loaded into the table?
Answers
At the very least you need to Ajax load the data - examples. You are currently DOM loading the data which is just about the slowest option available. Ajax loading with deferred rendering will be fine for 15'000 rows.
The next step beyond that is server-side processing.
Allan
I am currently implementing server-side processing but I get an error with code 7 that is http://datatables.net/tn/7 and the resulting explanation is not quite as per what I see in my debugger...how can I change the "throw" and is which code file do I do that?
What does your debugger show?
Allan
Hi,
Thanks for the response...it gives me this error under Response tab: MySQL Error: 1064..
Under Headers tab the status code is given as 500 Internal Server Error
My debug code:http://debug.datatables.net/orodiq am trying to change my DT_bootstrap.js file so that it can reflect the new changes I have made but still gives out the same in the debug code...I wonder where the problem might be.I currently am using LIMIT 200 for my 15.000 records table because of slow loading and cannot also search through the records because of the error code 7
Given "MySQL Error: 1064.." I would be checking my server-side processing script.
Hi Tangering,
I used this example for the server-side scripting: https://datatables.net/development/server-side/php_mysql
I just changed the variables to fit my connection string...here is my output: http://debug.datatables.net/orodiq
Where would I add this line: $.fn.dataTable.ext.errMode = 'throw'; in which js script for the error to go away?
A MySQL error isn't going to "go away". You have to find out what your sql query looks like and fix it.
Tangerine, am wondering what might be wrong as I have tried looking at the SQL query but the only suspect is "LIMIT" which I use because loading all my data into the table is taking ages...have you seen the code I use for server-side scripting?
The script you linked to is a legacy script. It should not be used with DataTables 1.10 unless you are using it in legacy mode (which it appears you are not - it looks like you are setting the Ajax options via the defaults in fact).
I would suggest you use the
ssp.class.php
script from here and also checkout the examples in that directory for how to use it.Allan
Hi Allan I'm even trying to run the demo from the examples folder but I get an error code 1.If I have a table called "members" from a db called "nochp" where would I place the table in the ssp.class.php file?
You wouldn't - the ssp.class.php file is a library file that is used by some other scripts. Did you look at the other examples in the directory listing I linked to above? They show how the
SSP
class can be used and where you define the table and columns.Allan
Yes Allan I looked at the other files anyway am currently working on it I will post my findings
I am using the ssp.class.php file but I get an error code 4 and I have tried looking at the forums and also the manual where my problem lies is that I'm supposed to have buttons on my page which are dynamically added, so that is where I hit a snag...any idea on how to put buttons there?here is my current code without server-side processing:
How do I put these buttons that I have here on my table when using server-side scripting?
Use
columns.render
for dynamic content (i.e. that depends upon the data in the row) orcolumns.defaultContent
for static content.Putting anything into a
tbody
loop when you have server-side processing enabled isn't going to do you any good at all since server-side processing will just remove it and replace it with the data retrieved from the server.Allan