2.8.8 • Published 4 years ago

simple-react-data-grid v2.8.8

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

Installation

Install with npm

$ npm install --save simple-react-data-grid

Usage

import DataGrid from 'simple-react-data-grid';
<DataGrid data={ArrayOfObjects} metaData={ArrayConfig} styles={'styles')} />	

Example for data and metaData

data = [
  {
    'firstName': 'Roseann',
    'lastName': 'Parker',
    'company': 'Zaggles',
    'employed': 'No',
  },
  {
    'firstName': 'Ford',
    'lastName': 'Knox',
    'company': 'Coriander',
    'employed': 'Yes',
  },
  {
    'firstName': 'Graves',
    'lastName': 'Randolph',
    'company': 'Supremia',
    'employed': 'No',
  },
  {
    'firstName': 'Sears',
    'lastName': 'Jackson',
    'company': 'Netagy',
    'employed': 'No',
  },
  {
    'firstName': 'Bernard',
    'lastName': 'Barrett',
    'company': 'Cubix',
    'employed': 'No',
  },
]

Sample Metadata:

metaData = {
     headerConfig: [
    {
      'label': 'First Name',
      'key': 'firstName',
      'type': 'string',
      'emptyCells': '',
    },
    {
      'label': 'Last Name',
      'key': 'lastName',
      'type': 'string',
      'emptyCells': '',
    },
    {
      'label': 'Company',
      'key': 'company',
      'type': 'string',
      'emptyCells': '',
    },
    {
      'label': 'Employed',
      'key': 'employed',
      'type': 'string',
      'disableFilter': true,
      'emptyCells': '',
    },
    {
      'label': 'Edit Information',
      'key': 'edit',
      'disableFilter': true,
      'excludeFromExport': true,
      'columnCustomComponent': 'checkBox',
    },
  ],
  topDrawer: {
    'pagination': false,
    'globalSearch': true,
    'clearButton': true,
    'exportButton': true,
    'totalRecords': false,
  },
  bottomDrawer: {
    'pagination': true,
    'globalSearch': true,
    'clearButton': false,
    'exportButton': false,
    'totalRecords': true,
  },
  enableRowSelection: true,
  enableAllRowSelection: true,
  recordsPerPage: 25,
  drawerPosition: 'top',
  includeAllInGlobalFilter: false,
  includeGlobalFilter: true,
  exportFileName: `FileName-${new Date()}.csv`, // For Demo
  loaderColor: '#a69fa8',
 }

Props specification:

propsdataTypeDescription
dataArrayThe array which contains column information. It contains array of objects of columns.Object represents the information of each row.Object properties
metaDataObjectmetaData object contains information form representation of 'simple-react-data. It is an object

metaData

metadata PropertiesdataTypeDescription
headerConfigArrayIt is an array of objects of each column representation information.Objects contains multiple properties listed below
labelStringIt represents the label of a particular column header.
keyStringIt represents the key of that particular column which is used for mapping row data.
typeStringIt represents the type of data to be present in that column. It should be 'string' or 'Number'.
emptyCellsStringIt represents the empty cell value. If data is not available in that particular cell of the column, the default value given for emptyCells will be pre-populated.
disableFilterBooleanUsed to disable the filter for a particular column.
excludeFromExportBooleanWill decide if a particular column should be removed from csv or not.
topDrawerObjectThis object represents the information of which feature will present in the top drawer.
bottomDrawerObjectThis object represents the information of which feature will present in the bottom drawer.topDrawer and bottomDrawer contains some properties listed below
enableRowSelectionBooleanIt represents the column header will contain all checked button or not.
enableAllRowSelectionBooleanIt represents the checkbox column present or not.
recordsPerPageBooleanIt represents the number of records per page.
includeAllInGlobalFilterBooleanIt represents the column header will contain all checked button or not.
includeGlobalFilterBooleanIt represents the grid contained global filter or not.
exportFileNameStringIt will give the name to CVS download file.
loaderColorStringIt will represent the color of all check loader.
getSelectedRowfunctionIt is call back function which is given to grid and this return the selected/checked row data.
Options for top & bottom drawerdataTypeDescription
paginationBooleanIt should be boolean & represent pagination is enabled or disabled.
globalSearchBooleanIt should be boolean & represent globalSearch is enabled or disabled.
clearButtonBooleanIt should be boolean & represent clearButton is enabled or disabled.
exportButtonBooleanIt should be boolean and its functionality is to export the grid data into CSV file, represent exportButton is enabled or disabled.
totalRecordsBooleanIt should be boolean & represent totalRecords is enabled or disabled.

npm.io

Live Demo

A live Demo is hosted on gh-pages.

2.8.8

4 years ago

2.8.7

4 years ago

2.8.6

4 years ago

2.8.5

4 years ago

2.8.4

4 years ago

2.8.3

4 years ago

2.8.2

4 years ago

2.8.1

4 years ago

2.8.0

4 years ago

2.7.0

5 years ago

2.6.0

5 years ago

2.5.0

5 years ago

2.4.0

5 years ago

2.3.0

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.4

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.12

5 years ago

2.0.11

5 years ago

2.0.10

5 years ago

2.0.9

5 years ago

2.0.8

5 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.16

5 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago