Column extensions for Reactabular
Last updated 4 years ago by bebraw .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install reactabular-column-extensions 
SYNC missed versions from official npm registry.

build status bitHound Score codecov

reactabular-column-extensions - Syntax extensions for Reactabular

reactabular-column-extensions provide syntax extensions for Reactabular column definition. Instead of typing out import and the related code, this takes some of that work away. You still have to connect the data processing portion, though.


The API provides a bind function that merges the given extensions together with the provided column definition.

import * as extensions from 'reactabular-column-extensions';

// Or you can cherry-pick
import { bind } from 'sortabular';
import { bind as bindExtensions } from 'sortabular';


extensions.bind([<extension>]) => ([<column>]) => [<adjusted column>]

The binder accepts an array of extensions and a column definition. It adjusts the columns based on this information and merges the configuration emitted by extensions top to bottom.

An extension has to be an object like this:

  match(column) {
    // If a column has `demo` property set, evaluate and merge
    return column.demo;
  evaluate(column) {
    // Emit a structure to attach to the column definition
    return {
      demo: true

If you want to implement a custom extension, you can wrap the object to a function and set defaults there.


extensions.draggableHeader({ onMoveColumns: <function> }) => <extension>

draggableHeader injects the configuration expected by reactabular-dnd if header.draggable is set. You still have to configure the rest, though.

extensions.highlightCell() => <extension>

highlightCell injects the configuration expected by highlighting functionality from searchtabular if cell.highlight is set. You have to connect the highlighting logic with your data processing to make this work.

extensions.resizableHeader({ window, onDragColumnStart, onDragColumn, onDragColumnEnd, props }) => <extension>

resizableHeader injects the configuration required for resizable headers if header.resizable is set. It accepts window so you can make resizing work in an iframe. Most often you don't need to touch the parameter, though. You should define onDragColumn(width, { column } handler and deal with the new width there. reactabular-resizable can be useful for that purpose. props allow you to inject custom styling/props to resizable.column.

extensions.sortableHeader({ sortingColumns, onSort, props, strategy }) => <extension>

sortableHeader is a light wrapper to sortabular that gets injected if header.sortable is set. It sets logic and user interface needed for altering sorting state. It also injects sort reset transform. sortingColumns, onSort(sortingColumns), props, and strategy follow sortabular interface. props allow you to customize styling/props of sortabular.sort.

extensions.toggleChildrenCell({ idField, parentField, onToggleShowingChildren, props, rows }) => <extension>

toggleChildrenCell gets injected if cell.toggleChildren is set. It has been designed to work with nested tree data of treetabular. It allows you to customize tree idField and parentField. In addition you have to define what happens when children are toggled using onToggleShowingChildren(rowIndex). If you want to customize treetabular.toggleChildren, you can pass props to it. The extension also expects you to pass the rows of your application to it.

Column Extension Example

The example below shows how the transformation works.


import * as extensions from 'reactabular-column-extensions';

const columns = [
    property: 'color',
    header: {
      label: 'Color',
      draggable: true
    property: 'name',
    header: {
      label: 'Name'
    cell: {
      highlight: true

const extendedColumns = extensions.bind([
    onMoveColumns: () => ({})

  (extendedColumns).map((d, i) =>
    <li key={`value-${i}`}>{JSON.stringify(d, null, 2)}</li>



Current Tags

  • 8.9.3                                ...           latest (4 years ago)

13 Versions

  • 8.9.3                                ...           4 years ago
  • 8.9.2                                ...           4 years ago
  • 8.9.1                                ...           4 years ago
  • 8.9.0                                ...           4 years ago
  • 8.8.1                                ...           4 years ago
  • 8.8.0                                ...           4 years ago
  • 8.7.1                                ...           4 years ago
  • 8.7.0                                ...           4 years ago
  • 8.6.0                                ...           4 years ago
  • 8.5.0                                ...           4 years ago
  • 8.4.0                                ...           4 years ago
  • 8.2.1                                ...           4 years ago
  • 8.0.0                                ...           4 years ago
Maintainers (2)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 3
Dependencies (0)
Dependents (1)

Copyright 2014 - 2017 © |