A library for simplifying rendering of large amounts of data
Module type
Class type
Library incr_dom_partial_render
type 'a t
val sorted_rows : 'a t -> 'a Key.Map.t
val sort_criteria : 'a t -> 'a Column.t Sort_criteria.t
val scroll_region : _ t -> Scroll_region.t option
val current_key : _ t -> row_id:Row_id.t -> Key.t option

current_key d row_id returns row_id's Key.t associated with the current sort criteria of d. Returns None if row_id does not exist in d

val visible_rows : 'a t -> Row_id.t list

Functions scroll_*_into_scroll_region and scroll_*_to_position will always work if the row heights in the model are correct (either because the row height estimate is correct for all rows, or because all rows have already been rendered and measured). If the row heights in the model are off, it may take multiple iterations of calling the scroll function and then remeasuring row heights in update_visibility before the specified element is successfully scrolled to its target.

val scroll_row_into_scroll_region : Model.t -> _ t -> Row_id.t -> Scroll_result.t
val scroll_col_into_scroll_region : Model.t -> _ t -> Column_id.t -> Scroll_result.t
val scroll_focus_into_scroll_region : Model.t -> _ t -> Scroll_result.t
val scroll_row_to_position : ?keep_in_scroll_region:unit -> Model.t -> _ t -> Row_id.t -> position:float -> Scroll_result.t
val scroll_col_to_position : ?keep_in_scroll_region:unit -> Model.t -> _ t -> Column_id.t -> position:float -> Scroll_result.t
val scroll_focus_to_position : ?keep_in_scroll_region:unit -> Model.t -> _ t -> position:(float * float) -> Scroll_result.t

Functions *_is_in_scroll_region and get_*_position return None if the specified element is not found (e.g. there is no focus, or there is no row/column with the given id), or if the visibility measurements are not yet available.

By default, the model's scroll margin is used to compute the bounds of the scroll region. However, if a scroll_margin argument is given, that will be use instead.

val focus_is_in_scroll_region : ?scroll_margin:Margin.t -> Model.t -> _ t -> bool option
val get_focus_position : Model.t -> _ t -> float option * float option
val get_focus_rect : Model.t -> _ t -> float Incr_dom.Js_misc.Rect.t option

Returns the bounding client rectangle of the currently focused cell, if any. This only returns a value if both the focus row and focus column are set.

val find_row_by_position : Model.t -> _ t -> float -> [ `Before | `At of Row_id.t | `After ] option

Finds the row id at a given vertical position on the page, or indicates that the position is before/after all the rows in the table. It only returns None if the model has no visibility info.

val find_col_by_position : Model.t -> _ t -> float -> [ `Before | `At of Column_id.t | `After ] option

Finds the column id at a given horizontal position on the page, or indicates that the position is before/after all the columns in the table. It only returns None if the model has no visibility info or if a call to Dom_html.getElementById_opt on a header cell id returns None.

val page_focus_row_target_position : Model.t -> _ t -> dir:Focus_dir.t -> float option

Returns the vertical position one page away from the current focus (above for dir = Prev or below for dir = Next). This can be used to implementing a page_focus_row function in multi-table pages. Note that the position returned is relative to the top of the page, not the top of the table.