Skip to content

Table

A sortable, scrollable table component that loads data on demand from a backing database table.

table

table(options)

Return a new table component with the provided options. Creates an instance of the Table class, connects it to coordinator, and returns the corresponding HTML element.

The supported options are:

  • as: The output selection. A selection clause is added for the currently selected table row.
  • filterBy: An optional selection by which to filter the contents of the table view.
  • from: The name of the backing database table or view.
  • columns: An ordered array of columns to include. If unspecified, all columns will be included.
  • align: An object providing optional column -> alignment mappings. The supported alignment values are "left", "center", and "right". If a column's alignment is not specified, a default alignment is chosen based on the data type.
  • format: An object providing optional column -> format function mappings. If provided, a format function will be invoked with the column value to produce a string to display. If a column's formatting is not provided, a default format is chosen based on the data type.
  • width: If a number, sets the width of the table view in pixels. If an object, provides a column name -> pixel width mapping for individual columns.
  • maxWidth: The maximum width of the full table view in pixels.
  • height: The height of the table view in pixels (default 500).
  • rowBatch: The number of additional rows to query upon scroll updates (default 100).
  • element: The container DOM element. If unspecified, a new div is created.

Table

new Table(options)

Class definition for a table component that extends MosaicClient. The constructor accepts the same options as the table method.

element

table.element

The HTML element containing the table view.