Lazily loading of DOM objects in large tables.

Lazily loading of DOM objects in large tables.

jchillerupjchillerup Posts: 2Questions: 0Answers: 0
edited July 2012 in Feature requests
Hi,

I'm currently making a mashup that fuses DataTables and Backbone models (one that is not as hacky as the previous attempts ;-)). Basically I'm loading model data by just giving aaData the two-dimensional array of the model data, but for automatic updating of the parts of the table that might be updated, things can get a little more tricky, so there.

Right now I'm investigating whether it is possible to not create the DOM nodes for the table rows on the invisible pages (i.e. those that the user hasn't browsed to yet) -- for very large datasets this seems like somewhat of a bottle neck. If the search functionality looks over the data-layer rather than the contents of the DOM, this would also work sort-of. I could do this by enabling bServerSide and override fnServerData to query my Backbone data layer instead.

But I would still really like if the script could do the DOM elements of the table data lazily, or even disposably: to generate the DOM elements as they are needed, and detaching them from the DOM when the user browses to a new page or does a search -- events that would in turn generate new rows to be shown. Is that possible in the vanilla DataTables, or would I need to hack the main distribution?

Best,
Jens Christian

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    > whether it is possible to not create the DOM nodes for the table rows on the invisible pages

    In DataTables-land we've termed it "deferred rendering": http://datatables.net/release-datatables/examples/ajax/defer_render.html . It does mean that the data need to be present (for client-side sorting, filtering etc), but the DOM nodes aren't created until needed.

    Allan
  • jchillerupjchillerup Posts: 2Questions: 0Answers: 0
    Looks good for now. Thanks, Allan.
This discussion has been closed.