Does deferRender also remove rows?

Does deferRender also remove rows?

jehugaleahsajehugaleahsa Posts: 11Questions: 3Answers: 0

I am using deferRender to only render rows as I scroll. When I use the browser inspector, I can see there are only 72 rows (in my case). I see that by running $('.dataTables_scrollBody tbody').children().length. I was surprised when I started scrolling down the page to see that top rows are removed from the DOM, as well, so the count stays 72 no matter what.

Is there a way to keep any previously rendered rows around? Can you confirm this is due to the scroller plugin and deferRender? Is there an event that gets fired whenever a row/cell is destroyed, in case I need to perform clean up?

Answers

  • jehugaleahsajehugaleahsa Posts: 11Questions: 3Answers: 0

    Ah, doing some more research and deferRender isn't really the full picture. From the docs for scroller it sounds like limiting the number of records is more a part of that functionality. I guess I was just surprised that rows get removed as you scroll.

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    Yep, deferRender doesn't have much purpose with Scroller, it's more useful when the entire table is being loaded at once. As you said, with Scroller, it moves the view, so rows not in the view buffer are removed.

    If you want to change the number of rows in that buffer, you can use scroller.displayBuffer,

    Colin

This discussion has been closed.