-
Notifications
You must be signed in to change notification settings - Fork 356
Simple React table
Martin Maroši edited this page Jul 18, 2019
·
1 revision
There was no easy way how to create table in with PF3 React. The only option is using reactabular which is unnecessary for your simple tables with no filtering, pagination etc.
We have added style tabled components and very basic Table component which is rendered from data.
-
<Table />
is equivalent to<table>
-
<TableHead />
is equivalent to<thead>
-
<TableBody />
is equivalent to<tbody>
-
<TableRow />
is equivalent to<tr>
-
<TableHeading />
is equivalent to<th>
-
<TableCell />
is equivalent to<td>
Components accept all standard table props.
All of these components are available to import from app/javascript/components/simple-table/simple-table.jsx
.
Uses above mentioned components to render table from data structure.
columns = [
[
'column-foo'// column identifier,
'Column Foo title'// column title,
{ // additional props of table cell in column. This is optional.
className: 'pf-action',
onClick: Function
}
], [
'column-bar',
'Different title'
]
]
rows = [{
'column-foo': 'Content' // rendered content of first row and column with name 'column-foo',
'column-bar': <button onClick={...}>Button</button> // content can be also react component
}]
Id of the table
Any other props given DataDrivenTable
component directly will be passed to the to <Table />