npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

simple-react-data-grid

v2.8.8

Published

A simple datagrid

Downloads

13

Readme

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:

| props | dataType | Description | | ------| -------- | ---- | | data | Array | The array which contains column information. It contains array of objects of columns.Object represents the information of each row.Object properties| | metaData |Object | metaData object contains information form representation of 'simple-react-data. It is an object|

metaData

| metadata Properties | dataType | Description | |---- | ---- | ----| |headerConfig| Array | It is an array of objects of each column representation information.Objects contains multiple properties listed below| |label|String |It represents the label of a particular column header.| |key | String| It represents the key of that particular column which is used for mapping row data.| |type| String |It represents the type of data to be present in that column. It should be 'string' or 'Number'.| |emptyCells| String |It 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.| |disableFilter| Boolean |Used to disable the filter for a particular column.| |excludeFromExport| Boolean |Will decide if a particular column should be removed from csv or not.| |topDrawer|Object|This object represents the information of which feature will present in the top drawer.| |bottomDrawer|Object|This object represents the information of which feature will present in the bottom drawer.topDrawer and bottomDrawer contains some properties listed below| |enableRowSelection|Boolean|It represents the column header will contain all checked button or not.| |enableAllRowSelection|Boolean|It represents the checkbox column present or not.| |recordsPerPage|Boolean|It represents the number of records per page.| |includeAllInGlobalFilter|Boolean|It represents the column header will contain all checked button or not.| |includeGlobalFilter|Boolean|It represents the grid contained global filter or not.| |exportFileName|String|It will give the name to CVS download file.| |loaderColor|String|It will represent the color of all check loader.| |getSelectedRow|function|It is call back function which is given to grid and this return the selected/checked row data.|

| Options for top & bottom drawer | dataType | Description | | ---- | ----| ----| | pagination |Boolean| It should be boolean & represent pagination is enabled or disabled. | | globalSearch |Boolean| It should be boolean & represent globalSearch is enabled or disabled. | | clearButton |Boolean| It should be boolean & represent clearButton is enabled or disabled. | | exportButton |Boolean| It should be boolean and its functionality is to export the grid data into CSV file, represent exportButton is enabled or disabled. | | totalRecords |Boolean| It should be boolean & represent totalRecords is enabled or disabled. |

Live Demo

A live Demo is hosted on gh-pages.