EZ data-grid
Light easy to use free open source to create custom React data grids.
Demo: https://izharfine.com/ezdatagrid/
Installation
npm install ez-data-grid --save
Usage simple example
import React useState from 'react';import EzGrid EzColumn from 'ez-data-grid'; { const mockData setMockData = ; const settings setSettings = ; return <EzGrid = = => <EzColumn = = /> <EzColumn = = = /> <EzColumn = = = /> <EzColumn = = = /> </EzGrid>;} ;
EzGrid
Params:
data (required) - Array of JSON objects
Will be that data for the grid rows.
settings - JSON object
Optional settings for the grid.
onSearchChange - function
Event handler call back, triggered on search change - return search input value.
onPageChange - function
Event handler call back, triggered on page changed - return page number.
onAddButtonClick - function
Event handler call back, creates add button - return column ids + titles.
onValueChange - function
Event handler call back, triggered on column value change (on editable mode) - return new value, row parent, column id, previous value.
onChooseRows - function
Event handler call back, triggered when row chosen (when disableChooseRows is off) - return the chosen row.
Settings(optional):
disableFilters - bool
Disable filters feature, default: false.
disableChooseRows - bool
Disable multi select feature, default: false.
disableSorting - bool
Disable sorting feature, default: false.
disablePaging - bool
Disable paging feature (paging very useful for much better performance specialy with big data), default: false.
maxHeight - string
Set the grid max-height prop, default: 736px.
Columns
Params:
key (required) - string
Unique key from your EzGrid data param that describes columns you want to render.
title (required) - string
The title you want for the column.
editable - bool
If this is editable column, if you use it you must provide the type prop as well.
type - string
Set the column type for editable mode. supported types: text, number, checkbox, date.
minWidth - string
Set the column min-width(only in pixels). default: 80px;
isWithoutData - bool
If this column have no data to take from EzGrid data (useful for custom coolumn).
Custom column:
You can create your own custom column, this is example for how to do it.
/ const CostumButton = { const customClick = e let rowData = propsparent; return <div => CLICK </div>} / <EzGrid = => <EzColumn ="id" ="Id"></EzColumn> <EzColumn ="gender" ="Gender"></EzColumn> <EzColumn ="title" ="Title"></EzColumn> <CostumButton = = /></EzGrid> /