• Stars
    star
    1,464
  • Rank 32,122 (Top 0.7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 5 years ago
  • Updated almost 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A react table component to display large datasets with high performance and flexibility

react-base-table

BaseTable is a react table component to display large datasets with high performance and flexibility

Install

# npm
npm install react-base-table --save

# yarn
yarn add react-base-table

Usage

import BaseTable, { Column } from 'react-base-table'
import 'react-base-table/styles.css'
// Important: if you fail to import react-base-table/styles.css then 
// BaseTable will not render as advertised in the included examples.
// For advanced styling see link below:
// https://github.com/Autodesk/react-base-table#advance
 ...
<BaseTable data={data} width={600} height={400}>
  <Column key="col0" dataKey="col0" width={100} />
  <Column key="col1" dataKey="col1" width={100} />
  ...
</BaseTable>
...

Learn more at the website

unique key

key is required for column definition or the column will be ignored

Make sure each item in data is unique by a key, the default key is id, you can customize it via rowKey

size

width is required for column definition, but in flex mode(fixed={false}), you can set width={0} and flexGrow={1} to achieve flexible column width, checkout the Flex Column example

width and height(or maxHeight) are required to display the table properly

In the examples we are using a wrapper const Table = props => <BaseTable width={700} height={400} {...props} /> to do that

If you want it responsive, you can use the AutoResizer to make the table fill the container, checkout the Auto Resize example

closure problem in custom renderers

In practice we tend to write inline functions for custom renderers, which would make shouldUpdateComponent always true as the inline function will create a new instance on every re-render, to avoid "unnecessary" re-renders, BaseTable ignores functions when comparing column definition by default, it works well in most cases before, but if we use external data instead of reference state in custom renderers, we always get the staled initial value although the data has changed

It's recommended to inject the external data in column definition to solve the problem, like <Column foo={foo} bar={bar} cellRenderer={({ column: { foo, bar }}) => { ... } } />, the column definition will update on external data change, with this pattern we can easily move the custom renderers out of column definition for sharing, the downside is it would bloat the column definition and bug prone

Things getting worse with the introduction of React hooks, we use primitive state instead of this.state, so it's easy to encounter the closure problem, but with React hooks, we can easily memoize functions via useCallback or useMemo, so the implicit optimization could be replaced with user land optimization which is more intuitive, to turn off the implicit optimization, set ignoreFunctionInColumnCompare to false which is introduced since v1.11.0

Here is an example to demonstrate

Browser Support

BaseTable is well tested on all modern browsers and IE11. You have to polyfill Array.prototype.findIndex to make it works on IE

The examples don't work on IE as they are powered by react-runner which is a react-live like library but only for modern browsers.

Advance

BaseTable is designed to be the base component to build your own complex table component

Styling

The simplest way is overriding the default styles (assuming you are using scss)

// override default variables for BaseTable
$table-prefix: AdvanceTable;

$table-font-size: 13px;
$table-padding-left: 15px;
$table-padding-right: 15px;
$column-padding: 7.5px;
...
$show-frozen-rows-shadow: false;
$show-frozen-columns-shadow: true;

@import '~react-base-table/es/_BaseTable.scss';

.#{$table-prefix} {
  &:not(.#{$table-prefix}--show-left-shadow) {
    .#{$table-prefix}__table-frozen-left {
      box-shadow: none;
    }
  }

  &:not(.#{$table-prefix}--show-right-shadow) {
    .#{$table-prefix}__table-frozen-right {
      box-shadow: none;
    }
  }

  ...
}

You can write your own styles from scratch or use CSS-in-JS solutions to achieve that

Custom components

<BaseTable
  classPrefix="AdvanceTable"
  components={{
    TableCell: AdvanceTableCell,
    TableHeaderCell: AdvanceTableHeaderCell,
    ExpandIcon: AdvanceExpandIcon,
    SortIndicator: AdvanceSortIndicator,
  }}
  ...
/>

Custom renderers & props

There are a lot of highly flexible props like xxxRenderer and xxxProps for you to build your own table component, please check the api and examples for more details

Example

We are using a advanced table component based on BaseTable internally, with much more features, including row selection, row grouping, data aggregation, column settings, column reordering, and column grouping, tooltip, inline editing.

AdvanceTable

In real products

Development

We use Yarn as the package manager, checkout this repo and run yarn under both root folder and website folder in install packages, then run yarn start to start the demo site powered by Gatsby

Contributing

Please check guidelines for more details

More Repositories

1

maya-usd

A common USD (Universal Scene Description) plugin for Autodesk Maya
Mathematica
761
star
2

Aurora

Real-time GPU path tracing with a USD Hydra render delegate
C++
430
star
3

revit-ifc

IFC for Revit and Navisworks (2019+)
C#
415
star
4

coroutineworker

Kotlin Coroutine-based workers for native
Kotlin
368
star
5

standard-surface

White paper describing the Autodesk Standard Surface shader.
CSS
341
star
6

continuous-threat-modeling

A Continuous Threat Modeling methodology
282
star
7

arnold-usd

Arnold components for USD
Python
243
star
8

animx

A project to make it easier for people to use Maya animation in their tools and pipelines.
C++
200
star
9

hig

Autodesk's unified design system
JavaScript
180
star
10

hubble

πŸ›° Collaboration, usage, and health data visualization for GitHub Enterprise
Python
176
star
11

molecular-design-toolkit

Notebook-integrated tools for molecular simulation and visualization
Python
164
star
12

synthesis

A Robotics Simulator for Autodesk Fusion CAD Designs
JavaScript
149
star
13

LiveLink

An Unreal Live Link plugin for Autodesk Maya
C++
120
star
14

quack

Quack - Reuse git modules in smart way
Python
115
star
15

civilconnection

CivilConnection enables the exchange of information between Civil 3D, Dynamo and Revit.
C#
87
star
16

XLB

XLB: Accelerated Lattice Boltzmann (XLB) based on JAX for Physics-based ML
Python
83
star
17

notebook-molecular-visualization

2D and 3D molecular visualization in Jupyter notebooks using 3DMol.js and D3.js
Python
67
star
18

molecule-3d-for-react

3D molecular visualization React component using 3Dmol.js
JavaScript
60
star
19

3DViewerComponent

A ThreeJS 3D Viewer Web Component composed with (Google's) Polymer
JavaScript
47
star
20

revit-stl-extension

An Autodesk Revit add-in to export Revit models to STL format.
C#
40
star
21

enterprise-config-for-git

A painless Git setup with an easy way to share Git configs and scripts within a company using GitHub Enterprise.
Shell
39
star
22

ADAppRater-iOS

Objective-C
39
star
23

bifrost-usd

Bifrost nodes for USD
C++
38
star
24

AutomaticComponentToolkit

A toolkit to automatically generate software components: abstract API, implementation stubs and language bindings
Go
38
star
25

sitoa

Arnold plugin for Softimage
Python
34
star
26

bionano-wetLabAccelerator

A tool for researchers working in synthetic biology and virology to design robotic wet lab protocols using a visual UI without coding.
JavaScript
33
star
27

aomi

Provide secrets to build and release pipelines in a self service way using Hashicorp Vault.
Python
32
star
28

sydevs

Simulation-based analysis of complex systems involving people, devices, physical elements, and dynamic environments.
C++
32
star
29

Neon

Multi-GPU Framework for Voxel Grid Computations
C++
31
star
30

machine-collaboration-utility

A CNC controller interface that allows for browser based job dispatching and real-time direct communication with devices over serial, usb, http, telnet, or any other communication protocol.
JavaScript
27
star
31

PowerShapeAndPowerMillAPI

An API for Autodesk PowerShape and PowerMill
C#
26
star
32

vault-admin-tools

Autodesk vault administration and data migration tools
C#
24
star
33

goatnative-inject

C++11 Dependency Injection (IoC - inversion of control) class using variadic templates and shared pointers.
C++
23
star
34

orion-ui

UI Components that work seamlessly in multiple UI frameworks
JavaScript
22
star
35

maya-hydra

A Maya plugin that replaces the main Maya viewport with a Hydra viewer.
C++
22
star
36

AutodeskMachineControlFramework

Middleware framework to integrate CAD/CAM software with machine hardware systems into a production-ready, complete and cohesive closed loop system.
C++
22
star
37

molecule-2d-for-react

2D molecule visualization component
ApacheConf
21
star
38

theo-loader

A webpack loader that transforms Design Tokens files using Salesforce's theo
JavaScript
21
star
39

go-awsecs

Library and tools for AWS ECS operations
Go
21
star
40

cam-posteditor

Autodesk HSM Post Processor for Visual Studio Code
HTML
19
star
41

flame-family

Custom Actions add-ins for Flame, Flare and Flame Assist.
Python
19
star
42

cloud-compute-cannon

Cloud Compute Cannon is a tool aimed at scientists and more general users who want to use cheap cloud providers (such as Amazon) to perform large scale computes (number crunching).
Haxe
18
star
43

genetic-constructor-ce

Genetic Constructor
JavaScript
17
star
44

shore

Go
16
star
45

molecular-simulation-tools

Web applications for molecular modeling using the Molecular Design Toolkit
JavaScript
16
star
46

RolloutManager-iOS

The Rollout Manager component is an iOS (Objective C) component that brings its users the ability to roll out features gradually to production.
Objective-C
16
star
47

watchdog4git

A GitHub πŸ€– that checks for common Git related errors and notifies the responsible engineers
Go
15
star
48

pyccc

Asynchronous job and file i/o management for containers
Python
15
star
49

nanodesign

Python package for working with nucleic acid structural designs.
Python
15
star
50

pgbelt

Pgbelt is a CLI tool used to manage Postgres data migrations from beginning to end, for a single database or a fleet, leveraging pglogical replication.
Python
15
star
51

ADNetPromoterScoreSurvey-iOS

ADNetPromoterScoreSurvey is an iOS component that presents Net Promoter Score (NPS) survey dialog to the user.
Swift
15
star
52

autodesk.github.io

A listing of open source efforts at Autodesk on GitHub
HTML
14
star
53

biomolecular-design-database

The Biomolecular Design Database Project is a web application that allows users to share, search and use nucleic acid nanotechnology designs. This includes DNA Origami, RNA Origami, DNA Bricks and many other types of systems.
JavaScript
14
star
54

powermill-api-examples

These examples export data from the PowerMill product and format it for use in various third-party simulation tools: Vericut, NCSimul, ViMill.
C#
13
star
55

sculpt-vr

A sculpting program for WebVR
JavaScript
13
star
56

composr

Live visualization of audio data in 3D
JavaScript
12
star
57

Central64

Central Grid Path Planning with up to 64 Neighbors
C++
10
star
58

forge-cli

Forge Command Line Interface (CLI) is a unified tool to manage your Forge services
JavaScript
8
star
59

NetfabbApplicationServer

The "Netfabb Application Server" (short: NAS) is a server (or: service) program written in Go, exposing a RESTful webservice API to client programs for a central storage system and distributed task management.
Go
7
star
60

jira-ldap-group-sync-plugin

LDAP Groups Sync for JIRA plugin
Java
7
star
61

IGA-saveload

C++
6
star
62

ADAppRater-UWP

A library for UWP designed to facilitate easy prompting of users to rate your app within the Windows store.
C#
6
star
63

jenkinsci-benchmark-plugin

Java
6
star
64

sjson

Simplified JSON parser
JavaScript
3
star
65

cryptorito

Very lightweight library for some cryptographic interactions
Python
3
star
66

powerinspect-api-examples

This addin exports measurement data from the PowerInspect product and formats it for use by various third-party Statistical Process Control (SPC) packages.
C#
2
star
67

motion-controller-emulator

A marlin firmware emulator. Created as a tool for supporting Machine Collaboration Utility (https://github.com/Autodesk/machine-collaboration-utility)
JavaScript
2
star
68

data-unit-test

JDBC test framework
Java
2
star
69

jira-action-reminders-plugin

JIRA Action Reminders Plugin
Java
2
star
70

featurecam-api-examples

Feature CAM API Examples (No Maintenance)
C#
1
star
71

viriondb

JavaScript
1
star