1.1.8 • Published 2 years ago

@toyesebalogun/reactgrids v1.1.8

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

reactgrids

Powerful, performant and feature-rich grid for React development.

Installation

# with npm
npm install @toyesebalogun/reactgrids

# with yarn
yarn add @toyesebalogun/reactgrids

Basic Usage

import { ReactGrid } from "@toyesebalogun/reactgrids";

const columns = [
  { name: "name", field: "name", width: 200 },
  { name: "email", field: "email", width: 250 },
  { name: "mobile", field: "phone", width: 140 },
  { name: "gender", field: "gender", width: 90 },
];

const rows = [
  {
    id: 1,
    name: "Paulie Brankley",
    email: "pbrankley0@reference.com",
    phone: "805-477-8432",
    gender: "Male",
  },
  {
    id: 2,
    name: "Roselle Corby",
    email: "rcorby1@linkedin.com",
    phone: "153-117-8104",
    gender: "Female",
  },
  {
    id: 3,
    name: "Thaine Jurges",
    email: "tjurges2@edublogs.org",
    phone: "210-129-7060",
    gender: "Male",
  },
  {
    id: 4,
    name: "Susannah Mansford",
    email: "smansford3@cbc.ca",
    phone: "980-718-9301",
    gender: "Female",
  },
];

const App = () => {
  return <ReactGrid columns={columns} rows={rows} />;
};

Props

ReactGrid accepts a wide range of compulsory and optional props and events. Each prop has adds a specific functionality to the component.

PropsTypeExampleDescription
columnsArray{name: "brand", field:"carbrand", width: 120}Contains an array of grid column header definitions.
rowsArray{carbrand: "Mercedes", year: "2022"}Contains an array of grid row data to be rendered.
onGridReadyFunction(params: GridReadyParams) => //...somethingAccepts a handler function as props
onRowClickedFunction(params: RowClickParams) => //...somethingAccepts a handler function as props
onCellClickedFunction(params: CellClickParams) => //...somethingAccepts a handler function as props

Custom Cell Renderer

import { ReactGrid } from "@toyesebalogun/reactgrids";
import rows from "./rows";
import { customGenderCellRenderer } from "./custom/cells";

const columns = [
  { name: "name", field: "name", width: 200 },
  { name: "email", field: "email", width: 250 },
  { name: "mobile", field: "phone", width: 140 },
  {
    name: "gender",
    field: "gender",
    width: 90,
    colRenderer: customGenderCellRenderer,
  },
];

const App = () => {
  return <ReactGrid columns={columns} rows={rows} />;
};

License

MIT

1.1.1

2 years ago

1.1.0

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.0

2 years ago