Render after deferRender?

Render after deferRender?

vol7ronvol7ron Posts: 43Questions: 11Answers: 0
edited March 2013 in General
[code]bDeferRender = true[/code]
When you have a table in IE7+8 that is over a couple hundred rows, you need to use defer render in order to increase loading times. However, if you need access to those non-rendered rows, you're left out-of-luck. This generally happens if you have a checkbox on each row and some "select all" method that should mark each as checked.

I'm curious if anyone has a method to do both a defered/non-defered rendering. I'm toying with the idea of perhaps render the displayed subset, show table, then create the elements in the background, afterwards.

How would one force the rendering? Should it be done in the fnInitComplete callback? Any thoughts?

Replies

  • allanallan Posts: 61,722Questions: 1Answers: 10,108 Site admin
    So you want the created DOM nodes, but you don't want to create the DOM nodes? :-) Fundamentally if you need the nodes, then you can't use deferred rendering.

    Having said that, you might be interested in how TableTools addresses this - using a custom property on the data source object: https://github.com/DataTables/TableTools/blob/master/media/js/TableTools.js#L1099

    Allan
  • vol7ronvol7ron Posts: 43Questions: 11Answers: 0
    edited March 2013
    Allan, thanks for your response.

    I want to delay the creation of the DOM nodes, but still create them. It's a matter of perception. My guess is create the rest of the nodes in batches using the setTimeout(0) technique to improve some performance.

    What I'm looking for is a compromise of when bDeferRender is true and false. Initial load = true, but then rendering is delayed (but a user can still scroll to render).

    I'll take a look at TableTools, thanks - I'll also have to look at what function actually creates a node, perhaps I can use it in the fnInitComplete
  • allanallan Posts: 61,722Questions: 1Answers: 10,108 Site admin
    > My guess is create the rest of the nodes in batches using the setTimeout(0)

    That is probably possible, but there isn't a built in way of doing that in DataTables. In deferred rendering mode, at each draw, it checks if the node is created and if not creates it. You could use that same logic in a setTimeout loop, but it will require a modification to the core. If you make it, I'd be interested to see your change.

    Allan
This discussion has been closed.