0.2.33 • Published 3 months ago

data-table-reactjs v0.2.33

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

data table reactjs Key Features

  • Declarative Configuration
  • Built-in and configurable:
    • Sorting
    • Filtering
    • Download
    • Pagination
  • Themeable/Customizable
  • Responsive

Installation

Data table react has only react as dependancy no other third party library is used.

API and Usage

Columns

Nothing new here - we are using an array of object literals and properties to describe the columns:

PropertyTypeRequiredExample
namestringyesthe display name of our Column e.g. 'Name'
selectorstringyesa data set unique property in dot notation. e.g. property1.nested1 . A selector is required anytime you want to display data but can be ommitted if your column does not require showing data (e.g. an actions column)
sortableboolnoif the column is sortable. columns will be sorted using basic sor functions and will have ability to sort string, date, number
filterableboolnoif the column is filterable. Rows will be filter by converting data to string type

Actions

PropertyTypeRequiredDefaultDescription
keystringyeskey to should be unique
labelstringnolabel for the action
handlerfunctionyesCall back to be called after action click which should accept index , item
classNamestringnoclass for the action

ReactDataTable Properties

Basic

PropertyTypeRequiredDefaultDescription
titlestringnoThe Title displayed in the Table Header
columnsarrayyes[]The column configuration
isLoadingboolnoShow a loader
loadingComponentComponent or stringnocustom component to display
listarrayyes[]List of records containing properties with name of column selector
actionsarrayno[]The action configuration
paginationboolnofalseto enable pagination
showSerialNumberboolnofalseto show the serial number as first column of table
showDownloadOptionboolnofalseto show download file option
defaultValForEmptystringno'-'Val to display when there is no value for any column
initiallyVisibleColarraynoallColumns to be diplayed intitally
hideOptionToSelectColboolnofalseHide option to select columns

Class Names to modify styles of table

the class names are self explantory and can be used to customize the table view containerClass | titleContainerClass | titleClass | downloadDropDownContainerClass | downloadDropDownClass | tableClass | tableWapperClass | headerRowClass | headerCellClass | headerIconContainerClass | filterInputContainerClass | filterInputFieldClass | filterInputApplyClass | tableBodyClassName | tableRowClass | tableCellClass | actionsClass | tableFooterClass | pageSizeDropDownContainerClass | pageSizeDropDownClass | pageNumberContainerClass | pageNumberCellClass | activePageCellClass | react-data-table-multi-select-dropdown | react-data-table-action-cell | react-data-table-action-cell-item All classes can be passed to table

Usage example

import ReactDataTable from 'data-table-reactjs';
const columns = [
  {
    name: 'column 1',
    selector: 'column1',
  },
  {
    name: 'column 2',
    selector: 'column2',
  },
];
const actions = [
  {
    key: 'viewDetails',
    handler: (index, item) => {
      console.log(index, item);
    },
    label: 'View record',
  },
];
const list = [
  {
    column1: 'Value 1',
    column2: 'value 2',
  },
  {
    column1: 'Value 3',
    column2: 'value 4',
  },
  {
    column1: 'Value 5',
    column2: 'value 6',
  },
];
const MyComponent = () => (
  <ReactDataTable
    title="Title of the table"
    columns={columns}
    list={list}
    actions={actions}
    showSerialNumber
  />
);
0.2.33

3 months ago

0.2.32

3 months ago

0.2.31

12 months ago

0.2.1

12 months ago

0.2.3

12 months ago

0.2.2

12 months ago

0.1.91

12 months ago

0.1.92

12 months ago

0.1.93

12 months ago

0.1.94

12 months ago

0.1.933

12 months ago

0.2.0

12 months ago

0.1.9

12 months ago

0.1.85

2 years ago

0.1.86

2 years ago

0.1.84

2 years ago

0.1.81

3 years ago

0.1.82

3 years ago

0.1.83

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.5

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago