Data table
Display the data in the table.
Examples
You need to add base class rd-datatable to any <table>.
Wrap the table with class rd-datatable-wrapper can prevent table too wide on small screen.
Therefore, users can view all data by scrolling left and right.
The class column-checkbox is for make column width best fit for the checkbox.
| ID | Name | Address | Actions | ||
|---|---|---|---|---|---|
| 1 | Shela Fosten | 7373 Vahlen Terrace | sfosten0@loc.gov | ||
| 2 | Desirae Helks | 43196 Northport Hill | dhelks1@google.de | ||
| 3 | Ted Ors | 92666 Cottonwood Crossing | tors2@ocn.ne.jp | ||
| ID | Name | Address | Actions |
Source
H Border
This data table only use horizontal border by add h-border to table class.
| ID | Name | Address | Actions | ||
|---|---|---|---|---|---|
| 1 | Shela Fosten | 7373 Vahlen Terrace | sfosten0@loc.gov | ||
| 2 | Desirae Helks | 43196 Northport Hill | dhelks1@google.de | ||
| 3 | Ted Ors | 92666 Cottonwood Crossing | tors2@ocn.ne.jp | ||
| ID | Name | Address | Actions |
Source
<table class="rd-datatable h-border">
...
</table>
Sortable columns
Example for sortable columns. Add the class sortable-icon to any sortable icon in the link to make it appears on hover.
| ID | Name | Address | Actions | ||
|---|---|---|---|---|---|
| 1 | Shela Fosten | 7373 Vahlen Terrace | sfosten0@loc.gov | ||
| 2 | Desirae Helks | 43196 Northport Hill | dhelks1@google.de | ||
| 3 | Ted Ors | 92666 Cottonwood Crossing | tors2@ocn.ne.jp | ||
| ID | Name | Address | Actions |
Source
<table class="rd-datatable">
<thead>
<tr>
<th class="sorted"><a href="?sort=id">ID <i class="order-asc sortable-icon"></i></a></th>
<th><a href="?sort=name">Name <i class="order-asc sortable-icon"></i></a></th>
</tr>
</thead>
...
</table>
Row colors
Add showing class to <tr>.
| Type | Class | Name | Actions | |
|---|---|---|---|---|
| Default | Shela Fosten | |||
| Primary | table-row-primary |
Desirae Helks | ||
| Info | table-row-info |
Ted Ors | ||
| Danger | table-row-danger |
Pauli Fero | ||
| Warning | table-row-warning |
Valaree Bedbury | ||
| Success | table-row-success |
Gaspar Treat | ||
| Type | Class | Name | Actions |
Source
<tr class="table-row-primary">...</tr>
<tr class="table-row-info">...</tr>
<tr class="table-row-danger">...</tr>
<tr class="table-row-warning">...</tr>
<tr class="table-row-success">...</tr>
Cell colors
Add showing class to table cell (<td>, or <th>).
| Default | Primary | Info | Danger | Warning | Success |
|---|---|---|---|---|---|
| Default | Primarytable-cell-primary |
Infotable-cell-info |
Dangertable-cell-danger |
Warningtable-cell-warning |
Successtable-cell-success |
| Info row color | Success | ||||
| This row contain no cell or row color. | |||||
| Default | Primary | Info | Danger | Warning | Success |
Source
<td class="table-cell-primary">...</td>
<td class="table-cell-info">...</td>
<td class="table-cell-danger">...</td>
<td class="table-cell-warning">...</td>
<td class="table-cell-success">...</td>
Data table with filters row
Add filter-row class to <tr> of the row that contain filters input.
| ID | Name | Address | Actions | ||
|---|---|---|---|---|---|
| 1000 | Chiquita Danton | 074 Iowa Drive | cdantonrr@barnesandnoble.com | ||
| 999 | Brice Brunnstein | 879 North Parkway | bbrunnsteinrq@comsenz.com | ||
| 998 | Traci Keeble | 4003 Northview Park | tkeeblerp@i2i.jp | ||
| ID | Name | Address | Actions |
Source
<tr class="filter-row">...</tr>
Responsive
This style of responsive is collapsible/expandable table for small screen size.
To make it work, add the classes responsive and rd-datatable to the <table>.
With this kind of responsive, you may not need to wrap the <table> with the class .rd-datatable-wrapper.
The class column-primary is for make that column always displayed on all screen sizes. This primary column should have only one per table.
The classes row-actions, and action are for display each table row actions and will be displayed on mouse hover.
The class toggle-row that added to the button is to make that button work as expand/collapse on small screen.
| Name | Address | ||
|---|---|---|---|
| Shela Fosten | 7373 Vahlen Terrace | sfosten0@loc.gov | |
| Desirae Helks | 43196 Northport Hill | dhelks1@google.de | |
| Ted Ors | 92666 Cottonwood Crossing | tors2@ocn.ne.jp | |
| Name | Address |
Source
And if there is no data in the responsive table.
| Name | Address | ||
|---|---|---|---|
| No data. | |||
| Name | Address | ||