# paginating-sorting

> ## for interface paginatingAndSorting of Spring Boot or other aplication with same params. **see dataTable example**

Latest version **0.0.6** (published 2022-02-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install paginating-sorting
pnpm add paginating-sorting
yarn add paginating-sorting
bun add paginating-sorting
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2022-02-24 |
| First published | 2022-01-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 143.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Erinell Barba |
| Maintainers | erinell |
| Keywords | table, pagination, sorting, spring boot, react |

## Links

- npm: https://www.npmjs.com/package/paginating-sorting
- Repository: https://github.com/erinell23/paginating-sorting
- Homepage: https://github.com/erinell23/paginating-sorting#readme
- Issues: https://github.com/erinell23/paginating-sorting/issues
- npm.io page: https://npm.io/package/paginating-sorting

## 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

- 0.0.6 (latest) — 2022-02-24
- 0.0.5 — 2022-02-24
- 0.0.4 — 2022-01-06
- 0.0.3 — 2022-01-05
- 0.0.2 — 2022-01-05
- 0.0.1 — 2022-01-02

## README

# Dynamic table with paging and sorting

## for interface paginatingAndSorting of Spring Boot or other aplication with same params.  **see dataTable example**
<br/>

## Parameters

- dataTable = ```{dataTableProperties}```
- onChange =  ```(resp: {order: string, page: number,sort: string}) => void```
    
<br/><br/>

# dataTable properties

| Name               | Type                        | Required  | Description                                                                |
| ------------------ | --------------------------- | --------- | -------------------------------------------------------------------------- |
| content            | `Array`<`{[key: string]: any}`> | Not    | JSONs array to populate the table.                                         |
| maxItemsShow       | `number`                    | Not        | Maximum amount of items (pages) to show in the pagination. Default ```3```.|
| number             | `number`                    | Yes        | Number of the current page                                                 |
| showLastedAndFirst | `boolean`                   | Not        | Allows to show or not the buttons to go back "«" and forward "»" the next `X` amount of pages. Default ```true``` |
| showPagination     | `boolean`                   | Not       | Allows to show or not show pagination. Default ```true```                  |
| titles             | `Array`<`TitleTableProps`>  | Yes       | Titles for table columns.                                                  |
| totalPages         | `number`                    | Yes       | Total pages.                                                               |


<br/><br/>

### dataTable example
<hr/>

```json
{
    "content":[
        {"id": 1,
        "name": "name1",
        "address": {
            "city": "ciudad1",
            "State": "State1",
            "Country": "Country1"
        }}...
    ],
    "number":0,
    "totalPages":10,
    "titles":[
        ...
    ]
}
```
<br/><br/>

# Titles properties (TitleTableProps)
| Name  | Type                      | Required                           | Description                     |
| ----- | ------------------------- | ----------------------------------- | ------------------------------- |
| sort  | `string`                  | Not                                  | Base text string to return when sorting a column, if not sent, the options in that column are hidden.   |
| name  | `string` or `Array`<`string`> | Yes, if you don't send  `sort` | Key to locate the value to show in the column. If it's a nested value, the keys are separated by a period. If you want to concatenate values in a column, the keys are sent in an array. |
| title | `any`                    | Yes                                 | Title to show Columns in the table.     |

<br/><br/>

### Titles example

<hr/>

```json
{"titles":[
    {
        "title":"ID",
        "sort":"id"
    },
    {
        "title":"Address",
        "sort":"city",
        "name":["address.city","address.state"]
    }
]}
```

<br/><br/>

# How to use

```
import { Table } from 'paginating-sorting'
```
```
const handleChangeTable = (pageAction) =>{
	console.log(pageAction);//order: string, page: number, sort: string
}
```
```
<Table dataTable={dataTable} onChange={handleChangeTable}/>
```

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