Logotype
JM Admin / Components / Data table
User

Data table

Display sets of data across rows and columns.

Features
  • CSS only, based on grid layout.
  • The columns are automatically configured. They can be adjusted to fit the content.
  • One column is for key (e.g. name), and is called the key column. Other columns are for values (e.g. date) or related data (e.g. link).
  • The key column takes up remaining space. Other columns can only be as wide as their content.
  • The first column is the key column by default. Another column can be set as the key column instead. Example
  • Javascript for progressive enhancement. Note
  • This component can be extended with more functionality via add-on: Bulk actions
Implementation
  • Include the compiled javascript file in the Html: <script src="/javascript/data-table.min.js"></script>

Examples

View source for Html code.


Default data table

Full width.

Cell A1
A2
A3
A4
Cell B1
B2
B3
B4
Cell C1
C2
C3
C4
Headings

For column descriptions. Can contain links and indications for sorting.

Cell A1
A2
A3
A4
Cell B1
B2
B3
B4
Cell C1
C2
C3
C4
Header

The header spans all columns.

Header
Cell A1
A2
A3
A4
Cell B1
B2
B3
B4
Cell C1
C2
C3
C4
Header with links

Right aligned links, single and grouped links, with icons.

Header
Add
Cell A1
A2
A3
A4
Cell B1
B2
B3
B4
Cell C1
C2
C3
C4
Pagination

Influenced by Material Design.

Header
Cell A1
A2
A3
A4
Cell B1
B2
B3
B4
Cell C1
C2
C3
C4

1-3 of 16

Text size and color

Columns can be displayed in smaller sizes and/or lighter color (for lesser important properties).

Header
Cell A1
A2
A3 small
A4 small light
Cell B1
B2
B3
B4
Cell C1
C2
C3
C4
Text alignment

Numbers are usually aligned right.

Header
Cell A1
A2 center
A3 right
A4 right
Cell B1
B2
B3
B4
Cell C1
C2
C3
C4
Context menu

For action links.

Header
Cell A1
A2
A3
A4
Cell B1
B2
B3
B4
Cell C1
C2
C3
C4
Collapse

On small screens:

Header
Cell A1
A2
A3
A4
Cell B1
B2
B3
B4
Cell C1
C2
C3
C4
Collapse without header
Cell A1
A2
A3
A4
Cell B1
B2
B3
B4
Cell C1
C2
C3
C4
Data list

For simpler and shorter content, such as time tables or price lists. Not full width. All columns can only be as wide as their content. A data list can have the same options (headings, header etc) as for other data tables.

Key
Value
Number
Cell A1
A2
A3
Cell B1
B2
B3
Cell C1
C2
C3
Change key column

Column number 1 (the first column) is the key column by default. Another column can be set as the key column instead. (Column 3)

Header
A1
A2
Cell A3
A4
B1
B2
Cell B3
B4
C2
C2
Cell C3
C4
Key column minimum width

Set a different minimum width to the key column. By default it is the same as the minimum width of its content.

Header
Cell A1 long long text with many words text to display the effect
A2 center long text to display the effect
A3 right long text to display the effect
A4 right long text to display the effect
Cell B1
B2
B3
B4
Cell C1
C2
C3
C4
Key column overflow

The key column can manage strings that are wider than the column (e.g. long words, urls or user input) in different ways:

Only overflowing strings will be affected. All text will wrap normally on breaking spaces (e.g. space or hyphen).

The width of the data tables below have been limited to show the effect.

Clip with ellipsis
Supercalifragilisticexpialidocious
A2
A3
A4
A long word: Supercalifragilisticexpialidocious
B2
B3
B4
Break and wrap
Supercalifragilisticexpialidocious
A2
A3
A4
A long word: Supercalifragilisticexpialidocious
B2
B3
B4
Break and wrap with changed key column (3)
A1
A2
Supercalifragilisticexpialidocious
A4
B1
B2
A long word: Supercalifragilisticexpialidocious
B4

Add-ons

This component can be extended with more functionality via add-on: Bulk actions


Javascript

The javascript file adds progressive enhancement for the component. Supports multiple components, so the script is only needed once on each page.

The component works without javascript, but the javascript adds the some additional functionality and style:

Data tables
Context menues (<details>)