Constructor
new TacoTable(props)
Parameters:
| Name | Type | Description |
|---|---|---|
props |
Object | React props |
Properties:
| Name | Type | Default | Description |
|---|---|---|---|
columns |
Array.<Object> | The column definitions |
|
columnGroups |
Array.<Object> | How to group columns - an array of
|
|
columnHighlighting |
Boolean | false | Whether or not to turn on mouse listeners for column highlighting |
className |
String | The class names to apply to the table |
|
data |
Array.<Object> | The data to be rendered as rows |
|
initialSortColumnId |
String | Column ID of the data to sort by initially |
|
initialSortDirection |
Boolean | true(Ascending) | Direction by which to sort initially |
plugins |
Array.<Object> | Collection of plugins to run to compute cell style, cell class name, column summaries |
|
sortable |
Boolean | true | Whether the table can be sorted or not |
striped |
Boolean | false | Whether the table is striped |
fullWidth |
Boolean | true | Whether the table takes up full width or not |
rowClassName |
function | Function that maps (rowData, rowNumber) to a class name |
|
rowHighlighting |
Boolean | true | Whether or not to turn on mouse listeners for row highlighting |
HeaderComponent |
function | TacoTableHeader | allow configuration of which component to use for headers |
RowComponent |
function | TacoTableRow | allow configuration of which component to use for rows |
- Source:
Extends
- React.Component
Methods
componentWillReceiveProps(nextProps) → {void}
On receiving new props, sort the data and recompute column summaries if the data has changed.
Parameters:
| Name | Type | Description |
|---|---|---|
nextProps |
Object | The next props |
- Source:
Returns:
- Type
- void
(private) handleColumnHighlight(columnId) → {void}
Callback when a column is highlighted
Parameters:
| Name | Type | Description |
|---|---|---|
columnId |
String | The ID of the column being highlighted |
- Source:
Returns:
- Type
- void
(private) handleHeaderClick(columnId) → {void}
Callback when a header is clicked. If a sortable table, sorts the table.
Parameters:
| Name | Type | Description |
|---|---|---|
columnId |
String | The ID of the column that was clicked. |
- Source:
Returns:
- Type
- void
(private) handleRowHighlight(rowData) → {void}
Callback when a row is highlighted
Parameters:
| Name | Type | Description |
|---|---|---|
rowData |
Object | The row data for the row that is highlighted |
- Source:
Returns:
- Type
- void
render() → {React.Component}
Main render method
- Source:
Returns:
The table component
- Type
- React.Component
(private) renderGroupHeaders() → {React.Component}
Renders the group headers above column headers
- Source:
Returns:
<tr>
- Type
- React.Component
(private) renderHeaders() → {React.Component}
Renders the headers of the table in a thead
- Source:
Returns:
<thead>
- Type
- React.Component
(private) renderRows() → {React.Component}
Renders the rows of the table in a tbody
- Source:
Returns:
<tbody>
- Type
- React.Component
shouldComponentUpdate(nextProps, nextState) → {Boolean}
Uses shallowCompare
Parameters:
| Name | Type | Description |
|---|---|---|
nextProps |
Object | The next props |
nextState |
Object | The next state |
- Source:
Returns:
If the component should update
- Type
- Boolean
(private) sort(columnId, props, state) → {Object}
Sort the table based on a column
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
columnId |
String | the ID of the column to sort by |
|
props |
Object | this.props | |
state |
Object | this.state |
- Source:
Returns:
Object representing sort state
{ sortDirection, sortColumnId, data }.
- Type
- Object
(private) summarizeColumns(props) → {Array}
Computes a summary for each column that is configured to have one.
Parameters:
| Name | Type | Description |
|---|---|---|
props |
Object | React component props |
- Source:
Returns:
array of summaries matching the indices for columns,
null for those without a summarize property.
- Type
- Array