0.1.27 • Published 6 years ago

eprofit v0.1.27

Weekly downloads
31
License
MIT
Repository
github
Last release
6 years ago

component library

DataTable component with bare minimum

No style libraries no dependencies

Live Example

only 1.5kB

PropertyTypeRequired
dataarray of objectsyes
columnsarray of objectsyes
mainColorstringno
uniqueKeystringno
toChangecallbackno

Property structure:

const data = [
  {
    id: 1,
    first_name: "Benedikta",
    last_name: "Lambard",
    email: "blambard0@epa.gov"
  },
  {
    id: 2,
    first_name: "Goldarina",
    last_name: "Aspell",
    email: "gaspell1@telegraph.co.uk"
  },
  ....
];

const columns = [
  {
    selector: "first_name",
    displayName: "First name"
  },
  {
    selector: "last_name",
    displayName: "Last name"
  },
  {
    selector: "email",
    displayName: "Email"
  }
];

<DataTable data={data} columns={columns} />

Feautures:

  • pagination
  • count results
  • choose records per page
  • page indicator
  • reset data
  • two directions order when you click on column title
  • click to column title and search into column
  • click to cell and edit
  • while edit a cell, press enter to save your editable value
  • while edit a cell, make a outer of cell click to discard the changes

Editable cells:

  • If you want a simple data table render avoid toChange prop
  • If you need the editable cells put inside toChange prop a callback and all will runs automatically

The toChange callback function return 4 parameters

  • newValue: the new updated value
  • fullRecord: full object of updated record
  • property: name of updated object property
  • index: in which index into array data the changes applied

Note: The data updated automatically, you have to use toChange callback to grab the data and use it for http update request

Note No 2: If your object has unique property not named id you can use uniqueKey prop to override the default.

0.1.27

6 years ago

0.1.26

6 years ago

0.1.22

6 years ago

0.1.21

6 years ago

0.1.20

6 years ago

0.1.19

6 years ago

0.1.18

6 years ago

0.1.17

6 years ago

0.1.16

6 years ago

0.1.15

6 years ago

0.1.14

6 years ago

0.1.13

6 years ago

0.1.12

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago