Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,12 @@ React.render(<Table columns={columns} data={data} />, mountNode);
<td></td>
<td>Called when column's cell is clicked</td>
</tr>
<tr>
<td>onHeaderClick</td>
<td>Function(event)</td>
<td></td>
<td>Called when column's header is clicked</td>
</tr>
</tbody>
</table>

Expand Down
1 change: 1 addition & 0 deletions src/Column.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ export default class Column extends Component {
]),
render: PropTypes.func,
onCellClick: PropTypes.func,
onHeaderClick: PropTypes.func,
}
}
3 changes: 3 additions & 0 deletions src/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ export default class Table extends React.Component {
if ('rowSpan' in column) {
cell.rowSpan = column.rowSpan;
}
if (typeof column.onHeaderClick === 'function') {
cell.onClick = column.onHeaderClick;
}
if (cell.colSpan !== 0) {
rows[currentRow].push(cell);
}
Expand Down