Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-datasheet-grid

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-datasheet-grid

Made with create-react-library

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16K
decreased by-3.29%
Maintainers
1
Weekly downloads
 
Created
Source

react-datasheet-grid

Made with create-react-library

NPM JavaScript Style Guide

Install

npm install --save react-datasheet-grid

Usage

import React from 'react'

import { DataSheetGrid } from 'react-datasheet-grid'
import 'react-datasheet-grid/dist/index.css'

const Example = () => {
  const [ data, setData ] = useState([
    { firstName: 'Elon', lastName: 'Musk' },
  ])


  const columns = [
    textColumn({ title: 'First name', key: 'firstName' }),
    textColumn({ title: 'Last name', key: 'lastName' }),
  ]

  return (
    <DataSheetGrid
      data={data}
      onChange={setData}
      columns={columns}
    />
  )
}

API

Props

data
onChange
columns
width

number default to 400

Width of grid in pixels.

height

number default to 300

Height of grid in pixels.

rowHeight

number default to 40

Height of a row in pixels.

headerRowHeight = rowHeight,

number default to rowHeight

Height of a the header row in pixels.

createRow

func() => any default to () => ({})

A function that should return a new row object. This function is called once per row every time the user appends or inserts new rows.

Most often used to add default values and / or random ids to new rows.

duplicateRow

func({ rowData }) => any default to ({ rowData }) => ({ ...rowData })

A function that should return a new row object from an existing row. This function is called once per row every time the user duplicates rows.

Most often used to override values and / or change uniq ids when duplicating rows.

isRowEmpty = ({ rowData }) => Object.values(rowData).every((value) => !value),
autoAddRow = false,
lockRows = false,

Columns

License

MIT © nick-keller

FAQs

Package last updated on 17 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc