Skip to content
Open
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
2 changes: 2 additions & 0 deletions src/column-definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ ColumnDefinition.PropTypes = {
displayName: React.PropTypes.string,
//The component that should be rendered instead of the standard column data. This component will still be rendered inside of a TD element.
customComponent: React.PropTypes.object,
//The component that should be rendered instead of the standard column header. This component will still be rendered inside of a TH element.
customHeadingComponent: React.PropTypes.object,
//Can this column be sorted
sortable: React.PropTypes.bool,
//What sort type this column uses - magic string :shame:
Expand Down
14 changes: 11 additions & 3 deletions src/table-heading-cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class TableHeadingCell extends React.Component {

const { className } = getStyleProperties(this.props, 'tableHeadingCell');
const classNames = classnames(className, this.props.columnProperty ? this.props.columnProperty.headerCssClassName : null)
const { sorted } = this.props;
const { sorted, state, title, sortAscending } = this.props;
const clickEvent = this.isSortable() ? this._handleClick : null;

return (
Expand All @@ -54,8 +54,16 @@ class TableHeadingCell extends React.Component {
onClick={clickEvent}
className={classNames}
>
{this.props.title} { this.getSortIcon() }
</th>);
{this.props.hasOwnProperty('customHeadingComponent') ?
<this.props.customHeadingComponent
state={state}
title={title}
sorted={sorted}
sortAscending={sortAscending}
sortIcon={this.getSortIcon()} /> :
[this.props.title, this.getSortIcon()]}
</th>
);
}

_handleHover() {
Expand Down