Server side export all problem
Server side export all problem
Hi..
I've seen a few discussions on this, but not my specific query.
I'm using server side, as client side it takes around 30 seconds to load the big table (30000 rows).
I realise that the export buttons only work for visible data for server side, so I added a "-1" to lengthMenu to get a full table download. That takes a few seconds, which is fine.
However, if I now click any of the export buttons, Chrome racks up a lot of cpu use, but never completes the export.
I assumed that, with the full table loaded locally, the export would work the same as with client side operation?
Using DT 1.13.7
Setup as below...
Any ideas?
Thanks
Pete.
new DataTable('#myTable', {
ajax: 'scripts/server_processing.php',
processing: true,
serverSide: true,
"pageLength": 25,
"lengthMenu": [ 15, 25, 50, 75, 100, -1 ],
dom: 'Blfrtip',
buttons: [ 'copy', 'csv', 'excel', pdf', 'print'
],
"deferRender": true,
"language": {
"infoFiltered": ""
}
});
Answers
Try without "deferRender" please. That is usually only needed without "serverSide". If you want to do a full table download you would need everything to rendered for export, I guess.
Good point, that was left over in error!
However, it makes no difference.
I added some extra lengthMenu items...
2500 lines exports in a couple of seconds.
5000 lines - and it fails.
Curious.
Further experiment - on two different servers - 2800 works, 2850 fails!
And, sanity check, if I revert to client side, it works fine.
Correct. Of course, the only thing server-side processing would be doing at this point is introducing network latency. If you know the end user is going to do this, then you should just load them all up front.
If you could link to a page showing the issue I might be able to help debug it a bit. Which export is failing? CSV is the lightest, PDF the heaviest.
Allan
They all fail, copy, pdf, csv, excel... at the same point, ok at 2800 entries, not at 2850!
Can't help feel it's something dumb I'm doing but I can't see it!
I sent login on a DM to you.
Refined it slightly - 2811 works, 2812 fails. I'd hoped the actual number might be clue...
Hi,
Thanks for the PM with the link!
In the console I see the error "too much recursion" which appears to be happening where it is attempting to strip HTML for the export.
Could you try changing:
To be:
Bit experimental, but let's see the impact of those options.
Allan
That works a treat!
Runs at all 23000 lines now.
Thanks!
I'll run some more exhaustive tests but it looks fine.
A quick aside - is there an easy way to add some sort of "loading" spinner or similar while it renders all the lines. It's only a few seconds but it would be nice, if it's easy!
You could use the processing() plug-in (which will be built into DataTables 2).
Out of interest, which of the combinations for
stripHtml
anddecodeEntities
did you go with? ThedecodeEntities
is the slow one. I've got a change for Buttons 3 that will improve performance there.Allan
Thanks for the plug in reference.
It was striphtml that was the problem, it worked with just that one set to false.
decodeentities on it's own didn't do it.
Many thanks for all the help!