Liking cljdoc? Tell your friends :D
ClojureScript only.

reagent-table.core


default-configcljs

source

reagent-tablecljs

(reagent-table data-atom config)

Create a table, rendering the vector held in data-atom and configured using the map config. The minimum requirements of config are :render-cell and :column-model.

There is a distinction between view and model coordinates for column numbers. A column's view position may change if it is reordered, whereas its model position will be that of its index into :column-model

:column-model is a vector of so-called render-info maps containing

  • :header A string for the header cell text
  • :key The reagent key for the column position in any rows. If absent defaults to the model index
  • :sortable false When :sort is present (see below) by default all columns are sortable. Otherwise any column can be excluded and no glyph will appear in its header. Other entries are as required by the client. The map is passed to the :render-cell function when cells are rendered.

:render-cell a function that returns the hiccup for a table cell (fn [render-info row row-num col-num] (...)) where render-info is the column entry, row is the vector child from data-atom, row-num is the row number and col-num is the column number in model coordiates.

:table-state an atom used to hold table internal state. If supplied by the client then a way to see table state at the repl, and to allow the client to modify column order and sorting state.

:row-key a function that returns a value to be used as the regaent key for rows (fn [row row-num] (...)) where row is the vector child from data-atom, row-num is the row number.

:sort a function to sort data-atom when a header cell sort arrow is clicked. Returns the newly sorted vector. If absent, the table is not sortable and no glyphs appear in the header. (fn [rows column-model sorting] (...)) where rows is the vector to sort, column-model is the :column-model and sorting is a vector of vectors of the form [column-model-index :asc|:desc]. If the column-model entry includes :sortable false the individual column is excluded from sorting. Select multiple columns for sorting by using ctrl-click. Repeat to toggle the sort direction.

:table the attributes applied to the [:table ... ] element. Defaults to {:style {:width nil}}}

:thead the attributes applied to [:thead ...]

:tbody the attributes applied to [:tbody ...]

:caption an optional hiccup form for a caption

:column-selection optional attributes to display visibly column toggles for example {:ul {:li {:class "btn"}}}

Create a table, rendering the vector held in data-atom and
configured using the map config. The minimum requirements of
config are :render-cell and :column-model.

There is a distinction between view and model coordinates for
column numbers. A column's view position may change if it is
reordered, whereas its model position will be that of its index
into :column-model

:column-model is a vector of so-called render-info maps containing
 - :header A string for the header cell text
 - :key The reagent key for the column position in any rows. If
   absent defaults to the model index
 - :sortable false When :sort is present (see below) by default all
   columns are sortable. Otherwise any column can be excluded and no
   glyph will appear in its header.
Other entries are as required by the client. The map is passed to
the :render-cell function when cells are rendered.

:render-cell a function that returns the hiccup for a table cell
  (fn [render-info row row-num col-num] (...))
where render-info is the column entry, row is the vector child from
data-atom, row-num is the row number and col-num is the column number
in model coordiates.

:table-state an atom used to hold table internal state. If supplied by
the client then a way to see table state at the repl, and to allow the
client to modify column order and sorting state.

:row-key a function that returns a value to be used as the regaent key
for rows
  (fn [row row-num] (...))
where row is the vector child from data-atom, row-num is the row number.

:sort a function to sort data-atom when a header cell sort arrow is clicked.
Returns the newly sorted vector. If absent, the table is not sortable and no
glyphs appear in the header.
  (fn [rows column-model sorting] (...))
where rows is the vector to sort, column-model is the :column-model and sorting
is a vector of vectors of the form [column-model-index :asc|:desc]. If the
column-model entry includes :sortable false the individual column is excluded
from sorting. Select multiple columns for sorting by using ctrl-click. Repeat
to toggle the sort direction.

:table the attributes applied to the [:table ... ] element. Defaults
to {:style {:width nil}}}

:thead the attributes applied to [:thead ...]

:tbody the attributes applied to [:tbody ...]

:caption an optional hiccup form for a caption

:column-selection optional attributes to display visibly column toggles
for example {:ul {:li {:class "btn"}}}
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close