How to use the react-table.ReactTableDefaults.ThComponent function in react-table

To help you get started, we’ve selected a few react-table examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github glin / reactable / srcjs / Reactable.js View on Github external
if (!pivotParentColumn.Header) {
      props.HeaderPivoted = 'Grouped'
    }
  }

  // Mark actual column group headers
  if (column.Header) {
    props.className = classNames('-headerGroup', column.className)
  }

  return props
}

// ThComponent that can render a custom HeaderPivoted element and be navigated
// using a keyboard, with sorting toggleable through the enter or space key.
const DefaultThComponent = ReactTableDefaults.ThComponent
class ThComponent extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      showFocus: false,
      clicked: false
    }
  }

  render() {
    let { HeaderPivoted, defaultSortOrder, isSortable, isSorted, isResizing, ...props } = this.props

    if (HeaderPivoted) {
      props.children = HeaderPivoted
    }