# semantic-data-grid

> Extended data grid for semantic ui

Latest version **1.0.40** (published 2020-02-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install semantic-data-grid
pnpm add semantic-data-grid
yarn add semantic-data-grid
bun add semantic-data-grid
```

## 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.40 |
| Published | 2020-02-05 |
| First published | 2018-12-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 775.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Denis Dyadyun |
| Maintainers | qimus |
| Keywords | react, semantic-ui, grid, data-grid, table |

## Links

- npm: https://www.npmjs.com/package/semantic-data-grid
- Repository: https://github.com/qimus/semantic-ui-grid
- Homepage: https://qimus.github.io/semantic-ui-grid
- Issues: https://github.com/qimus/semantic-ui-grid/issues
- npm.io page: https://npm.io/package/semantic-data-grid

## Dependencies (10)

- [qs](https://npm.io/package/qs.md) ^6.5.2
- [react](https://npm.io/package/react.md) ^16.6.3
- [redux](https://npm.io/package/redux.md) ^4.0.1
- [history](https://npm.io/package/history.md) ^4.7.2
- [react-dom](https://npm.io/package/react-dom.md) ^16.6.3
- [redux-form](https://npm.io/package/redux-form.md) ^7.4.2
- [react-redux](https://npm.io/package/react-redux.md) ^5.1.1
- [react-router](https://npm.io/package/react-router.md) ^4.3.1
- [react-router-dom](https://npm.io/package/react-router-dom.md) 4.2.2
- [semantic-ui-react](https://npm.io/package/semantic-ui-react.md) ^0.83.0

## 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.40 (latest) — 2020-02-05
- 1.0.32 — 2019-06-28
- 1.0.31 — 2019-06-27
- 1.0.30 — 2019-04-03
- 1.0.29 — 2019-02-15
- 1.0.27 — 2019-01-28
- 1.0.25 — 2019-01-24
- 1.0.24 — 2018-12-20
- 1.0.23 — 2018-12-13
- 1.0.22 — 2018-12-12
- 1.0.21 — 2018-12-12
- 1.0.20 — 2018-12-11
- 1.0.19 — 2018-12-07
- 1.0.18 — 2018-12-07
- 1.0.17 — 2018-12-07
- … 17 more at https://npm.io/package/semantic-data-grid/versions

## README

Installation
-----------

**npm i --save semantic-data-grid**

Example: **cd example/ && npm i && npm start. Enjoy!**

[Live demo](https://qimus.github.io/semantic-ui-grid/)

Hot it use
----------

```javascript
import {
    Column,
    Provider as DataProvider,
    Action,
    ExtTable,
    setHistory
} from 'semantic-grid'

const history = createBrowserHistory({ basename: '' });
setHistory(history);

const provider = new DataProvider.ArrayDataProvider({ data: store.getItems() });

const columns = [
    {
        title: '#',
        type: Column.SERIAL_COLUMN,
        sortable: true
    },
    {
        title: 'First Name',
        field: 'first_name',
        sortable: true
    },
    {
        title: 'Last Name',
        field: 'last_name',
        sortable: true
    },
    {
        title: 'E-mail',
        field: 'email',
        sortable: true,
    },
    {
        title: 'Country',
        field: 'country',
        sortable: true
    },
    {
        title: 'Actions',
        type: Column.ACTION_COLUMN,
        actions: [
            {
                component: Action.EditAction,
                link: (row) => `/users/${row.id}`
            },
            {
                component: Action.DeleteAction,
                action: ({ id }) => {
                    store.deleteItem(id);
                }
            }
        ]
    }
];
const filter = {
    name: 'users_filter',
    items: [
        {
            name: 'first_name',
            type: 'text',
            label: 'First Name'
        },
        {
            name: 'last_name',
            type: 'text',
            label: 'Last Name'
        },
        {
            name: 'email',
            type: 'text',
            label: 'Email'
        },
        {
            name: 'country',
            type: 'text',
            label: 'Country'
        }
    ]
};

class DemoGrid extends Component {
    render() {
        return (
            <Grid>
                <Grid.Row>
                    <Grid.Column width={1}></Grid.Column>
                    <Grid.Column width={14}>
                        <Header as={'h2'}>Semantic ui grid example</Header>
                        <Button floated='right' primary onClick={() => this.props.history.push('/users/new')}>Create</Button>
                        <ExtTable
                            filter={filter}
                            sortable={true}
                            header={'Sortable grid'}
                            provider={provider}
                            columns={columns}/>
                    </Grid.Column>
                </Grid.Row>
            </Grid>
        )
    }
}
```

ExtTable props
-------

|Prop|Type|Description|
|----|----|-----------|
|filter|Object| which include filter name and array of filter items |
|provider|Function| Instance one of ApiDataProvider or ArrayDataProvider|
|onPageChange| Function| Handler which will be call after each one page change|
|columns|Array| Array of table columns|
|header|String| Header of grid|
|sortable|Bool|Columns of table can sortable|
|isFetching|Bool| Indicate to show loader|
|filterNamePrefix|String|Prefix for filter params in search of browser|

Column props
-----

|Prop|Type|Description|
|----|----|-----------|
|columnOptions|Object|Any props from Table.Cell Semantic ui|
|component|React.Component|Custom component for render cell|
|type|string|One of type which was registered with *registerColumnTypes* function|
|value|any||
|field|string|Name of the field that value will be show|

Filter props
-----------

|Prop|Type|Description|
|----|----|-----------|
|type|string|One of type which was registered with *registerFilterTypes* function|
|component|React.Component|Custom component|
|updateAfterChange|bool|After each change fetch data|
|options|object|Props for Grid.Column|

Custom types
------------
You can define custom types of columns and filters.
For example:

```javascript
import { registerColumnTypes } from 'semantic-grid'

import MyCustomSuperColumn from './super-column'

const SUPER_COLUMN = 'super_column';

registerColumnTypes({
    [SUPER_COLUMN]: MyCustomSuperColumn
});

let columns = [
    {
        type: SUPER_COLUMN,
        //.....
    }
];

class MyComponent extends React.Component {
    render() {
        return (
            <ExtTable columns={columns}
                //some other props
            />
        )
    }
}

```

Screenshots
----------
![Grid overview](public/1.png)

![Sort](public/2.png)

![Filter](public/3.png)

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