package incr_dom_partial_render

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

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.

val create : ?override_header_on_click: (Column_id.t -> Js_of_ocaml.Dom_html.mouseEvent Js_of_ocaml.Js.t -> unit Incr_dom.Vdom.Effect.t) -> Model.t Incr_dom.Incr.t -> old_model:Model.t option Incr_dom.Incr.t -> inject:(Action.t -> unit Incr_dom.Vdom.Effect.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.

val on_display : old_model:Model.t -> Model.t -> _ Extra.t -> unit

Used for scrolling to rows/columns upon focusing them

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

Used to handle sort column clicking

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

Measures rows, table and viewport

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

We set z-indexes using inline styles for proper rendering. You can set your own values for these by providing css variable values (search for `z_index_name` to see this in the ml file.)

OCaml

Innovation. Community. Security.