Constructor
new TacoTable(props)
Parameters:
Name | Type | Description |
---|---|---|
props |
Object | React props |
Properties:
Name | Type | Default | Description |
---|---|---|---|
bottomData |
Array.<Object> | Boolean | Special rows to place at the bottom of the table,
unaffected by sorting. If true, populates values based on the |
|
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 |
|
fullWidth |
Boolean | true | Whether the table takes up full width or not |
initialSortColumnId |
String | Column ID of the data to sort by initially |
|
initialSortDirection |
Boolean | true(Ascending) | Direction by which to sort initially |
onRowClick |
function |
|
|
onRowDoubleClick |
function |
|
|
onSort |
function |
|
|
plugins |
Array.<Object> | Collection of plugins to run to compute cell style, cell class name, column summaries |
|
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 |
sortable |
Boolean | true | Whether the table can be sorted or not |
striped |
Boolean | false | Whether the table is striped |
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. If the onSort callback is provided, it is fired with the columnId, sort direction, and new sorted data as arguments.
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) renderBottomData() → {React.Component}
Renders the bottom data of the table in a separate tbody.
This data is configured by the bottomData
table prop and the
bottomData
field in column definitions. It is not affected by
sorting.
- Source:
Returns:
<tbody>
- 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
(private) sort(columnId, props, state, keepSortDirection) → {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 | |
keepSortDirection |
Boolean | false | Whether to keep the same sort direction if sorting on the same column as what the data is already sorted on or not. Used primarily when receiving new data that should maintain its current sort. |
- 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