rx-datatable

Lists, trees and treeable tables for React with pluggable reactivity and theming

A red prohibition sign struck through the word SLOP
Designed and built in 2022+ by a senior developer obsessed with code quality. The same guy reviewed & edited AI-assisted features.

Features

Sorting

User just clicks column header. Secondary and tertiary ordering just works.

Clicking column headers to sort a table

Column Resizing

You pick a size; user can resize. Unclaimed space is distributed among columns.

Dragging a column edge to resize it

Tree nesting

A table and tree at the same time. Write it how you want: as a function that gets each item's parent, or as a function that gets each item's children. Children can be collapsed.

Expanding and collapsing rows of a tree grid

Multiple row types

Use different row configurations to support multiple data types in the same table

In this example, the first row has value null which is rendered as a special "All 3" row

A table mixing several kinds of rows

Virtualization

Up to 10,000 rows
virtualization delays rendering to improve perf, but it's not designed for huge datasets

Trees and lists

DataTable is built on simpler ListBox/TreeList components

ListBox and TreeList components

Standard HTML

Unlike some systems, you can style DataTable with CSS like anything else

Styling a DataTable with ordinary CSS

Custom rendering

It's just normal React content

Custom React content rendered in cells

Pinning & col-spans

Just use position: 'sticky' in the style of the column's cellProps. Merge cells horizontally with getColSpan.

A pinned column and merged cells

Themes

Try them below — color schemes and metrics (spacing, tree indent) are separate, so they mix and match with one line of code.

Reactivity

Pluggable reactivity system supports MobX directly; some assembly required for other systems.

Try it

Loading demo…

Sixty-second tour

import { DataTable } from 'rx-datatable';

export function Numbers() {
    return (
        <DataTable<{n: number}, number>
            list={[ { n:3 }, { n:4 }, { n:5 }, { n:36 }, { n:16 }, { n:100 } ]}
            selMode="multi"
            columns={[
                {
                    name: 'n', heading: 'Number', isTreeCol: true,
                }, {
                    name: 'Square',      getValue: (item: {n: number}) => item.n * item.n
                }, {
                    name: 'Square root', getValue: (item: {n: number}) => Math.sqrt(item.n)
                }, {
                    name: 'Odd?',        getValue: (item: {n: number}) => (item.n & 1) !== 0
                },
            ]}
            getParents={item => {
                let root = Math.sqrt(item.n);
                return root === Math.round(root) ? [ { n: root } ] : undefined;
            }}
            getSelKey={item => item.n}
        />);
}

See the manual for the common usage patterns (plain tables, tree grids, multiple row types, theming, MobX integration), and the API reference for every export, prop and type.