A small tool to help improve the rendering performance of very large HTML tables.
$ npm install --save kruster
Kruster is a tool used to speed up the performance of tables which contain a lot of content.
To do this, it only renders rows which are actually visible within the client height of the specified element that wraps the table.
Kruster can handle rows of varying row height.
0lily(025)-firstname.lastname@example.org some roaddean parkmega place<!-- ... Plenty of other rows. Like, lots ... -->email@example.com burnsey roadmiddlenowhere
/** Create an instance of Kruster and cluster the target table rows. */var kruster =tableBody: documentscrollableParent: document;
|tableBody (required)||DOM Element||The target table which contains the rows to cluster.|
|scrollableParent (required)||DOM Element||The scrollable parent that wraps the target table. Only clusters which reside in the visible portion of this element will be displayed.|
|clusterSize||number||The number of rows to each cluster. Smaller clusters mean more frequent updates but minimises the number of rows being displayed. Default: 25|
|autoRefresh||boolean||Whether Kruster should refresh in response to window resize events. Default: false|
|onClusterShow||function||Callback which is called when a cluster is shown. An object containing the clusters index and contained rows are passed as an argument.|
|onClusterHide||function||Callback which is called when a cluster is hidden. An object containing the clusters index and contained rows are passed as an argument.|
Kruster instance. This is required when the size of the table or the heights of any rows change in order to reassess the heights of any clusters.
Get an array of all of the table rows, excluding any rows that were injected by
Get a row at the specified index, excluding any rows that were injected by
Get the index of the specified row element in the clustered table, excluding any rows that were injected by
Get the table body, cleansed of the DOM and style modifications made by
Takes an optional boolean argument which defines whether the table should be cleansed of any modifications made by
Kruster. Default: true
MIT © [Nikolas Howard]