zambezi / grid

D3 component for drawing grids
MIT License
4 stars 2 forks source link

Expose row changed key optimization hook #22

Closed gabrielmontagne closed 8 years ago

gabrielmontagne commented 8 years ago

Description

The grid's body subcomponent supports a couple of optimization hooks that this PR exposes.

You can help the grid decide which rows do not need to be redrawn by associating the DOM row with a particular datum (preserving object constancy) and then providing a changed function that will describe what changes on a row update so that the grid can skip it if no update is needed.

See the proposed man for a more detailed description.

Motivation and Context

Grid performance is always an important topic (see, for example, #20) -- but because the grid tries to be flexible on the use cases it covers some optimizations need some help from the end user. Telling the grid when it can skip the update of a row (or multiple rows) can help speed up the grid significantly -- cell formatters and components will be skipped, etc.

How Was This Tested?

A rig has been created and added to the examples, as well as a "live" block here, https://bl.ocks.org/gabrielmontagne/d9bca200af7ee7330ed82fa804551565

Types of changes