### Parameters

`Key : Key`

### Signature

`module Key = Key`
`module Height_cache : sig ... end`

Height_cache keeps track of the rendered height of items so that scrolling to a given position can decide which elements to render accurately. This allows rows to have different heights and change height at runtime.

`type 'v t`````

Meant to be stored in the derived model

`val create : rows:'v Key.Map.t Incr_dom_widgets__.Import.Incr.t ‑> height_cache:Height_cache.t Incr_dom_widgets__.Import.Incr.t ‑> measurements:Incr_dom_widgets__.Partial_render_list_intf.Measurements.t option Incr_dom_widgets__.Import.Incr.t ‑> 'v t Incr_dom_widgets__.Import.Incr.t`
`val find_by_position : _ t ‑> position:float ‑> Key.t option`
`val find_by_relative_position : _ t ‑> Key.t ‑> offset:float ‑> Key.t option`
`val rows_to_render : 'v t ‑> 'v Key.Map.t`

Meant for rendering, apps should normally use Incr.Map.mapi' on this

`val spacer_heights : _ t Incr_dom_widgets__.Import.Incr.t ‑> (float * float) Incr_dom_widgets__.Import.Incr.t`

(top, bottom) spacer pixel heights to put the rendered rows in the right place

`val scroll_into_scroll_region : ?⁠in_:Incr_dom_widgets.Util.Scroll_region.t ‑> _ t ‑> top_margin:float ‑> bottom_margin:float ‑> key:Key.t ‑> Incr_dom_widgets.Util.Scroll_result.t`

Scroll the view to the row with the given key, scrolling the minimum amount possible while still being `(top|bottom)_margin` pixels away from the top and bottom of the screen. If this can't be satisfied, the margin will be reduced to the point where it can. If a margin of 0 can't show the whole element, it will prefer showing the top.

`?in` determines the element which should be scrolled. Default is `Window

`val scroll_to_position : ?⁠in_:Incr_dom_widgets.Util.Scroll_region.t ‑> _ t ‑> position:float ‑> key:Key.t ‑> Incr_dom_widgets.Util.Scroll_result.t`
`val scroll_to_position_and_into_region : ?⁠in_:Incr_dom_widgets.Util.Scroll_region.t ‑> _ t ‑> position:float ‑> top_margin:float ‑> bottom_margin:float ‑> key:Key.t ‑> Incr_dom_widgets.Util.Scroll_result.t`

`is_in_region` and `get_position` return `None` if the given key does not exist or the view rect and list rect measurements are not yet available.

`val is_in_region : _ t ‑> top_margin:float ‑> bottom_margin:float ‑> key:Key.t ‑> bool option`
`val get_position : _ t ‑> key:Key.t ‑> float option`
`val get_top_and_bottom : _ t ‑> key:Key.t ‑> (float * float) option`
`val measure_heights_simple : _ t ‑> measure:(Key.t ‑> float option) ‑> Height_cache.t`

`measure_heights_simple` updates a height cache by measuring the rendered elements, relying on the app to provide a function for finding and measuring the element for a given key. This function can be used for table with collapsed borders and box sizing set to border-box.

`val measure_heights : _ t ‑> measure_row:(Key.t ‑> 'm option) ‑> get_row_height:(prev:'m option ‑> curr:'m option ‑> next:'m option ‑> float option) ‑> Height_cache.t`

`measure_heights` is like `measure_heights_simple`, but allows the app to use the previous and next rows in addition to the current row to measure the current row's height (e.g. using the bottom position of the previous row and/or the top position of the next row). To avoid retaking the same measures three times for each row (once as the "previous" row, once as the "current" row, and once as the "next" row), `measure_row` allows the app to specify what measurements to take for a given row, and it is called exactly once per row. This function should be used for tables with non-collapsed borders.