Closed edelooff closed 8 years ago
Turns out the 10x speedup I mentioned is a bit exaggerated. The following is a result from playing with the Timeline from the Chrome dev tools. Values are averages over 10 sort clicks on the same column (and the cpu set to performance to remove some noise):
Somewhere around an average 4x speedup for reasonably paged results.
The code in goToPage
is a bit slower than the detached table body which inserts all rows, so with a sufficiently large page size, it will end up being slower. However, detaching and re-attaching the body also comes with overhead, which would affect typical small page size. And even at 1000 rows per page, the new code is a good bit faster :smiley:
:ship: :santa:
looks/works great!
This PR brings two improvements to pagination. It resolves #24, allowing a script (or user) to enable pagination (via the
enablePagination
method) after timbles has been initiated on the table.Secondly, it resolves #25 by not placing off-page rows on the DOM. For my 2300-row test table, with a page size of 100 rows, this means the sorting time is down from roughly 200ms to about 20ms.
Code-wise the following changes have been made:
data.$records
jQuery object has been replaced withdata.tableRows
, which is an array of DOM nodes;sortColumnEvent
by recreating thistableRows
array;enablePagination
, if no config is present, an emptydata.pagination
object is created.Tests for pagination will follow some other time.