package incr_dom_partial_render

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

Module Table.MakeSource

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
Sourcemodule Sort_key = Sort_spec.Sort_key
Sourcemodule Sort_dir = Sort_spec.Sort_dir
Sourcemodule 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.

Sourcemodule Base_sort_criteria : sig ... end
Sourcemodule Html_id : sig ... end
Sourcemodule Column : sig ... end
Sourcemodule 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.

Sourcemodule Model : sig ... end
Sourcemodule Action : sig ... end
Sourcemodule 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.

Sourceval set_focus_row : Model.t -> Row_id.t option -> Model.t
Sourceval set_focus_col : Model.t -> Column_id.t option -> Model.t
Sourcetype '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.

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

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

Used for scrolling to rows/columns upon focusing them

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

Used to handle sort column clicking

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

Measures rows, table and viewport

Sourceval view : ?override_header_on_click: (Column_id.t -> Js_of_ocaml.Dom_html.mouseEvent Js_of_ocaml.Js.t -> unit Incr_dom_partial_render__.Import.Vdom.Effect.t) -> Model.t Incr_dom.Incr.t -> 'a Extra.t Incr_dom.Incr.t -> render_row:'a row_renderer -> inject:(Action.t -> unit Incr_dom_partial_render__.Import.Vdom.Effect.t) -> attrs:Incr_dom_partial_render__.Import.Vdom.Attr.t list -> Incr_dom_partial_render__.Import.Vdom.Node.t Incr_dom.Incr.t

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.)