Empty values returning from ajax (server side) in datatables
Empty values returning from ajax (server side) in datatables
DigitalD
Posts: 6Questions: 0Answers: 0
I am facing with a problem with server side script. The count of the rows are correct but the data is empty. There was an error also that the values cannot empty or NULL. I have added defaultContent to the colums in the script with the message 'Not set' and now the rows are correct but i have only the 'Not set' notification.
I tried to add the UTF-8 Charset but still not working.
What do you need of code to see where the problem is?
Replies
Hi @DigitalD ,
We're happy to take a look, but it would help, as per the forum rules, if you could link to a running test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Hi Colin, how it is possible to simulate server-side processing problem via live.datatables.net ? Where could I upload the serverprocessing.php and ssp.class.php ?
Maybe collecting debugger output will help:
https://datatables.net/manual/tech-notes/10#DataTables-debugger
Post a link to the resulting debug collection.
Or you could post your Datatables init code, a snippet of the HTML code for your table and the ajax response using the browser's network tools. Steps can eb found here:
https://datatables.net/manual/tech-notes/1
Kevin
Hi Kevin, thank you for quick response. If I can ask you some general question.. I have large table (20k rows) in mysql and when I load it to html with for loop, it takes about 30 seconds which is useless for me. Will using server-side processing dramatically decrease this time to about 2-5 seconds? Thank you
You can read the server side processing doc to get an understanding of the process and requirements:
https://datatables.net/manual/server-side
Also take a look at the FAQ:
https://datatables.net/faqs/index#speed
Basically with server side processing Datatables will request the data for the current page (10 rows by default) for each draw. A draw occurs when initially loading the table, sorting, searching, etc of the table. Each draw is a network request to the server however the expected data to be returned is that of the current page.
I would assume that moving to server side processing would reduce the load time to just seconds.
Kevin
Because of the server side it is not possible to show you a link, but i can paste my code? Is it also ok?
Because the data is coming from a database
Ok, here is my code for js file:
Ok, here is my code for js file:
I got this message after debugging (see answer Kevin): Upload complete - itahiz
Kevin, is that enough for you?
I don't see your code. Why don't you start with collecting debugger output:
https://datatables.net/manual/tech-notes/10#DataTables-debugger
Give us the link or code it generates.
Kevin
If you encounter this error, see also this thread.
Allan