really slow - deferRender+ column.render with array of objects - checking if people get it to work
really slow - deferRender+ column.render with array of objects - checking if people get it to work
Hello
this is datatables 1.10.5
I've got a big array of javascript objects of the form [{'thing':obj}] being set to the datatable's 'data' property, and using deferRender is still pretty slow. I am using column.render for each column, with each column having column.data='thing', as I pull out/massage different parts of the object for each column.
I'm still messing with this, but wondered if anyone else has gotten a nicely performing deferRender to work for a very large array of objects.
thanks
This question has an accepted answers - jump to answer
Answers
also wanted to add - it seems to be calling the render callback for ALL entries of the array, whether or not they are visible, which seems like deferRender isn't even being used
ok - after looking at this a little, it might be because jquery.Extend is being called on the settings with a deep copy, and my objects in the array have a deepish structure
whoa - that was it. I tried just using an array of the ids as datasource and look things up in the render method to find the object and it's very fast
Hi,
Good to hear you've got this fixed and running smoothly now.
Why was the settings object being extended? Was that somewhere in DataTables?
Allan
Yes it was in datatables . It's not in front of me atm but as part of init it does the extend
Here's the line in the github src that had the extend I was referring to:
https://github.com/DataTables/DataTablesSrc/blob/f4d088020e88ecb2e079f61254934acec7026ec2/js/core/core.constructor.js#L77
Hi,
I've just added a comment to your blog post on this topic - this very certainly is a bug in DataTables! For the benefit of anyone else who reads this, this is a repeat (and slightly revised to make sense here) of my comments from @bfl's blog:
DataTables actually implements its own
extend
method to stop the need of deep cloning the data property. I "got away" with it was it was, as the clone was actually being overwritten later on - so in fact the clone was being done with absolutely no benefit...I've just committed a fix which will be in DataTables 1.10.6 and is now in the nightly if you fancy trying it immediately :-).
Thanks for finding this error and letting me know about it!
Allan