incr_dom_partial_render

A library for simplifying rendering of large amounts of data
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library incr_dom_partial_render

Parameters

module Row_id : Id
module Column_id : Id

Signature

module Row_id = Row_id
module Column_id = Column_id

This isn't just an int so that if an app adds columns the sort is maintained properly by the app's own classification instead of index. But it can be an int.

module Sort_spec = Sort_spec
module Sort_key = Sort_spec.Sort_key
module Sort_dir = Sort_spec.Sort_dir
module Sort_criteria : sig ... end

A 'a Sort_criteria.t specifies a list of columns by which to sort the rows of a table, in order of precedence from highest to lowest. Each column's sort criteria is made up of a direction and a value of type 'a, which varies as the sort criteria goes through several rounds of processing.

module Base_sort_criteria : sig ... end
module Html_id : sig ... end
module Column : sig ... end
module Key : sig ... end

This is the key used for sorting functionality. Apps don't need to touch this to use this widget, it is only exposed in case apps need to do something involving sorting in the same way as the table will.

module Model : sig ... end
module Action : sig ... end
module Extra : sig ... end

Used to expose some extra information about a component that's useful for applications that need more control over scrolling, sorting and focus management.

val set_focus_row : Model.t -> Row_id.t option -> Model.t
val set_focus_col : Model.t -> Column_id.t option -> Model.t
type 'a row_renderer = row_id:Row_id.t -> row:'a Incr_dom.Incr.t -> Row_node_spec.t Incr_dom.Incr.t

When constructing the row Vdom.Node.t (most likely using function Vdom.Node.tr), it is important to pass in the argument ~key:id. Otherwise scrolling may have unexpected behavior.

type 'row t = ( Action.t, Model.t, unit, 'row Extra.t ) Incr_dom.Component.with_extra
val create : ?override_header_on_click: ( Column_id.t -> Js_of_ocaml.Dom_html.mouseEvent Js_of_ocaml.Js.t -> Incr_dom.Vdom.Event.t ) -> Model.t Incr_dom.Incr.t -> old_model:Model.t option Incr_dom.Incr.t -> inject:( Action.t -> Incr_dom.Vdom.Event.t ) -> rows:'row Row_id.Map.t Incr_dom.Incr.t -> columns:(Column_id.t * 'row Column.t) list Incr_dom.Incr.t -> render_row:'row row_renderer -> attrs:Incr_dom.Vdom.Attr.t list -> 'row t Incr_dom.Incr.t

Returns a Component.with_extra with Extra.t as the extra value. The extra value is not needed for most applications using the Table.

The input render_row should render <tr> nodes, and attrs should be a list of Vdom attributes for the table.

module Derived_model : sig ... end
val on_display : old_model:Model.t -> Model.t -> _ Derived_model.t -> unit

Used for scrolling to rows/columns upon focusing them

val apply_action : Model.t -> _ Derived_model.t -> Action.t -> Model.t

Used to handle sort column clicking

val update_visibility : Model.t -> _ Derived_model.t -> Model.t

Measures rows, table and viewport

Returns a full partially-rendered <table> node with header. render_row function should render <tr> nodes.

val current_key : _ Derived_model.t -> row_id:Row_id.t -> Key.t option
val scroll_row_into_scroll_region : Model.t -> _ Derived_model.t -> Row_id.t -> Table_intf.Scroll_result.t
val scroll_col_into_scroll_region : Model.t -> _ Derived_model.t -> Column_id.t -> Table_intf.Scroll_result.t
val scroll_focus_into_scroll_region : Model.t -> _ Derived_model.t -> Table_intf.Scroll_result.t
val focus_is_in_scroll_region : ?scroll_margin:Table_intf.Margin.t -> Model.t -> _ Derived_model.t -> bool option
val get_focus_position : Model.t -> _ Derived_model.t -> float option * float option
val get_focus_rect : Model.t -> _ Derived_model.t -> float Incr_dom.Js_misc.Rect.t option
val scroll_row_to_position : ?keep_in_scroll_region:unit -> Model.t -> _ Derived_model.t -> Row_id.t -> position:float -> Table_intf.Scroll_result.t
val scroll_col_to_position : ?keep_in_scroll_region:unit -> Model.t -> _ Derived_model.t -> Column_id.t -> position:float -> Table_intf.Scroll_result.t
val scroll_focus_to_position : ?keep_in_scroll_region:unit -> Model.t -> _ Derived_model.t -> position:(float * float) -> Table_intf.Scroll_result.t
val find_row_by_position : Model.t -> _ Derived_model.t -> float -> [ `Before | `At of Row_id.t | `After ] option
val find_col_by_position : Model.t -> _ Derived_model.t -> float -> [ `Before | `At of Column_id.t | `After ] option