react-table/docs/api/useColumnOrder.md
Tanner Linsley 8ba553871f
Add useColumnVisibility as core hook (#1700)
* Update utils.js

* Update useTable.js

* Create useColumnVisibility.js

* Update useColumnVisibility.js

* Update useColumnVisibility.js

* Convert to core hook, use new reducerHanndler/actions

* Add useColumnVisibility internal hook
2019-12-05 15:45:25 -05:00

1.2 KiB

useColumnOrder

  • Plugin Hook
  • Optional

useColumnOrder is a plugin hook that implements basic column reordering. As columns are reordered, their header groups are reverse-engineered so as to never have orphaned header groups.

Table Options

The following options are supported via the main options object passed to useTable(options)

  • state.columnOrder: Array<ColumnId>
    • Optional
    • Defaults to []
    • Any column ID's not represented in this array will be naturally ordered based on their position in the original table's column structure
  • initialState.columnOrder
    • Identical to the state.columnOrder option above

Instance Properties

The following values are provided to the table instance:

  • setColumnOrder: Function(updater: Function | Array<ColumnId>) => void

    • Use this function to programmatically update the columnOrder.
    • updater can be a function or value. If a function is passed, it will receive the current value and expect a new one to be returned.
  • Source

  • Open in CodeSandbox