# react-form-data-table

> React component with form based data table, compromising all data table features with ajax and more..

Latest version **1.0.25** (published 2021-05-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-form-data-table
pnpm add react-form-data-table
yarn add react-form-data-table
bun add react-form-data-table
```

Provides the command `react-form-data-table`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.25 |
| Published | 2021-05-28 |
| First published | 2021-05-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 153.4 KB |
| Known vulnerabilities | 0 (+24 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Bharani Palani |
| Maintainers | bharani-palani |
| Keywords | data table, react, react table, react pagination, react form table, ajax table, ajax grid, react form, search table, searchable table, grid, grid table, table, pagination, pagination table, filter, filter table, sort, sort table |

## Links

- npm: https://www.npmjs.com/package/react-form-data-table
- Repository: https://github.com/bharani-palani/react-form-data-table
- Homepage: https://bharani-palani.github.io/react-form-data-table
- Issues: https://github.com/bharani-palani/react-form-data-table/issues
- npm.io page: https://npm.io/package/react-form-data-table

## Dependencies (12)

- [axios](https://npm.io/package/axios.md) ^0.21.1
- [react](https://npm.io/package/react.md) ^17.0.2
- [babel-cli](https://npm.io/package/babel-cli.md) ^6.26.0
- [node-sass](https://npm.io/package/node-sass.md) ^4.13.1
- [react-dom](https://npm.io/package/react-dom.md) ^17.0.2
- [web-vitals](https://npm.io/package/web-vitals.md) ^1.1.1
- [code-prettify](https://npm.io/package/code-prettify.md) ^0.1.0
- [react-scripts](https://npm.io/package/react-scripts.md) 4.0.3
- [react-router-dom](https://npm.io/package/react-router-dom.md) ^5.2.0
- [@testing-library/react](https://npm.io/package/@testing-library/react.md) ^11.2.6
- [@testing-library/jest-dom](https://npm.io/package/@testing-library/jest-dom.md) ^5.12.0
- [@testing-library/user-event](https://npm.io/package/@testing-library/user-event.md) ^12.8.3

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 1.0.25 (latest) — 2021-05-28
- 1.0.24 — 2021-05-22
- 1.0.23 — 2021-05-20
- 1.0.22 — 2021-05-20
- 1.0.21 — 2021-05-19
- 1.0.20 — 2021-05-18
- 1.0.18 — 2021-05-17
- 1.0.17 — 2021-05-17
- 1.0.16 — 2021-05-17
- 1.0.15 — 2021-05-16
- 1.0.14 — 2021-05-16
- 1.0.13 — 2021-05-15
- 1.0.12 — 2021-05-15
- 1.0.11 — 2021-05-14
- 1.0.10 — 2021-05-14
- … 10 more at https://npm.io/package/react-form-data-table/versions

## README

## React Form Data Table
### Features
- Supports search string, records per page and pagination
- Dynamic form elements to manipulate and save your data
- UX available with light and dark theme
- Adaptive for tablet and mobile viewports
- Ajax put, post, update etc.. can be configured.
- Row element onChange event, to update changes in row data, using dynamic form elements
- Clone your custom data to data table
- Show tooltip for elements
- Configure Footer total with tailor made requirements
- Configure pagination as you wish
- Add a custom class name to change data table style. <br />*(Note:)*  This table is styled using display: grid with grid-template-columns

### A Demo is always awesome
[https://bharani-palani.github.io/react-form-data-table](https://bharani-palani.github.io/react-form-data-table)

### Usage
```html
<ReactFormDataTable
  data={[
    {id: 10000, name: "John", age: 21, salary: 50000},
    {id: 10003, name: "Woo", age: 28, salary: 60000}
    ...
  ]}
/>
```

### Props
Property  | Type | Default | Sample
----------- | -------| -------- | -------------
data | Array | [ ] | Refer Data Table
TableAliasRows | Array | [ ] | [ID, Name, Age, Salary]
showTotal | Array | [ ] | [salary]
rowElements | Array | [ ] | Refer rowElements table
insertCloneData | Array | [ ] | [{id: 10002, name: "Woo", age: 31, salary: 70000}]
showTooltipFor | Array | [ ] | [name]
apiInstance | Object | | Refer below table
defaultValues | Object | { } | {age: "21"}
config | Object | { } | Refer Config table
className | String |  | `my-custom-table`
defaultValues | Object | { } | { age: 21 } <br /> *Note:* value will be added to element during adding rows in table
cellWidth | String | `12rem` | 20rem or 200px
theme | String | light| `light` or `dark`
onTableUpdate() | function | | Callback after table form is updated
insertCloneData | Array | [ ] | Clone your custom data to the top of your table.<br />Refer Data Table

### Data Table

<pre>
[
  {
    "id": 10000,
    "name": "John",
    "age": 21,
    "salary": 50000
  },
  {
    "id": 10003,
    "name": "Woo",
    "age": 28,
    "salary": 60000
  }
  ...
]
</pre>

### Config sample
See [https://www.w3schools.com/jsref/jsref_tolocalestring.asp](https://www.w3schools.com/jsref/jsref_tolocalestring.asp) for locale, currency and maxDecimal settings

<pre>
{
  "footer": {
    "total": {
      "locale": "en-IN",
      "currency": "USD",
      "maxDecimal": 2,
      "doubleEntryBalanceStrings": {
        "zero": "Settled",
        "plus": "Ahead",
        "minus": "Behind"
      }
    },
    "pagination": {
      "currentPage": "first",
      "recordsPerPage": 10,
      "maxPagesToShow": 5
    }
  }
}
</pre>

**Note:**
- currency can be USD, INR etc..
- currentPage can be "first" or "last"

### rowElements
Value  | Render element | Type|  Description
----------- | -------| --- | -------- 
textbox | `<input />` | String |Text box to enter strings
number | `<input />` | String | Text box to enter numbers 
textarea | `<textarea />`| String | Text area to enter paragraphs 
checkbox | `<button />` | String | + and - buttons to add or remove. <br /> **Note:** Should always be in the first position in array of objects. See to that the values are unique to update values accordingly. Watch [Demo](https://bharani-palani.github.io/react-form-data-table)
radio | `<input type="radio" />` | Object | Refer radio sample below
multiChoice | `<PreDefined />`| Object | Refer multiChoice sample below
date | `<PreDefined />` | Object | Drop down date picker.<br /> Ex: `new Date()`
dateTime | `<PreDefined />`| Object | Drop down date and time picker.<br /> Ex: `new Date()`

### radio sample

<pre>
{
  "radio": {
    "radioList": [
      {
        "label": "Male",
        "value": "Male",
      },
      {
        "label": "Female",
        "value": "Female",
      }
    ]
  }
}
</pre>

### multiChoice sample

<pre>
{
  "multiChoice": {
    "dropDownList": [
      {
        "id": "Mobile",
        "value": "Mobile"
      },
      {
        "id": "Email",
        "value": "Email"
      },
      {
        "id": "Land line",
        "value": "Land line"
      }
    ]
  },
  "searchable": false
}
</pre>

**Note:**
- If value is string("Mobile"), single select drop down is rendered.
- If value is array(["Mobile", "Email"]), multi select select drop down is rendered.<br /> *Array can be empty.*
- "searchable" key is default to true, which helps to search values from the list. <br />To disable search functionality, you can set it to false. <br />*This feaure is only for multi select select drop.*

### [apiInstance](#api-ins)
#### We use [Axios](https://www.npmjs.com/package/axios) for xmlHttpRequest()

| Property | Type | Sample
| -- | -- | -- |
|Table  | String | EmployeeMySqlTable
| baseURL | String | https://myapiservices.com |
| headers | Object | { Authorization: `MySecretHashKey` } |
| ajaxApiUrl | String | /V1/updateEmployeeInformation |
| payloadKeyName | String | `postData` `putData` `payload` etc.. |
| ajaxType | String | `put` `post` `update` etc.. |
| onAjaxCallBack | Function | (data) => showMessage(data) |
| ajaxButtonName | String | `Save` |
| onReFetchData | Function <br />`Only success callback` | (data) => reRenderTableFromApi(data) |

### You like my work?
#####  [Contribute](https://bharani.tech/contribute) to cheer me up more open source..

---
_Source: https://npm.io/package/react-form-data-table · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
