An open API service indexing awesome lists of open source software.

https://github.com/unosquare/tubular-react

Material UI table with local or remote data-source. Featuring filtering, sorting, free-text search, export to CSV locally, and aggregations.
https://github.com/unosquare/tubular-react

datagrid grid hoc material-ui react webcomponent

Last synced: 6 months ago
JSON representation

Material UI table with local or remote data-source. Featuring filtering, sorting, free-text search, export to CSV locally, and aggregations.

Awesome Lists containing this project

README

          

[![npm version](https://badge.fury.io/js/tubular-react.svg)](https://badge.fury.io/js/tubular-react)
![Buils status](https://github.com/unosquare/tubular-react/workflows/Node.js%20Package/badge.svg)

![Tubular-React](https://unosquare.github.io/assets/tubular.png)

** THIS REPO HAS BEEN ARCHIVED**

**Tubular-React** is a [Material-UI](https://material-ui.com/) table (or data grid) with local or remote data-source. Featuring:

- Define a custom layout for columns and cells using `render` methods.
- Use a remote or local datasource. Remote datasource use a specific Request and Response format.
- Sort and filter multiple columns.
- Free-text search of string columns.
- Page data. Remote data is paged in the server side.
- Export data to a CSV file.
- Print data.

You can try a [CodeSandbox demo](https://codesandbox.io/s/818mwv72ll).

Please visit the [Tubular GitHub Page](http://unosquare.github.io/tubular) to learn how quickly you can start coding. See [Related projects](#related-projects) below to discover more Tubular libraries and backend solutions.

# Table of contents

- [Table of contents](#table-of-contents)
- [Installation](#installation)
- [Usages](#usages)
- [`DataGrid`](#datagrid)
- [DataGrid with a remote data source](#datagrid-with-a-remote-data-source)
- [DataGrid with a local data source](#datagrid-with-a-local-data-source)
- [Tubular react in a grid list](#tubular-react-in-a-grid-list)
- [Run integrated sample](#run-integrated-sample)
- [i18n Support](#i18n-support)
- [Related Projects](#related-projects)

## Installation

```sh
$ npm install tubular-react --save
```

## Usages

You can check the documentation of the components at [https://unosquare.github.io/tubular/tubular-react](https://unosquare.github.io/tubular/tubular-react)

### `DataGrid`

You can start using `DataGrid` with this sample code. The grid will connect to a remote datasource or have a local datasource depending on what it's passed in the dataSource property.

To create Column you have to use **createColumn** function and have to pass the desired name of column as string.
```js
import React from 'react';
import ReactDOM from 'react-dom';

import { DataGrid } from 'tubular-react';
import {createColumn} from "tubular-common";

const columns = [createColumn('OrderID'), createColumn('CustomerName'), createColumn('ShipperCity')];

const SampleGrid = () => (

);

ReactDOM.render(, document.getElementById('root'));
```

This is a preview of the previous code:

![DataGrid](https://user-images.githubusercontent.com/25437790/57318742-a7a2b200-70c0-11e9-8d5b-aaf2107bd059.gif)

### DataGrid with a remote data source
It is possible to display data from a remote source.

![Remote](https://user-images.githubusercontent.com/36867256/85425475-d71fb280-b53e-11ea-9aee-33308b6f79d4.gif)

[![Edit RemoteDataGrid -Example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/remotedatagrid-example-forked-lnt7h?fontsize=14&hidenavigation=1&theme=dark)

### DataGrid with a local data source
It is possible to display data from a local data source.

![Local](https://user-images.githubusercontent.com/36867256/85425715-24038900-b53f-11ea-9248-e03ca1c43d8a.gif)

[![Edit LocalDataGrid -Example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/localdatagrid-example-forked-sif6w?file=/src/LocalDataGrid.tsx&fontsize=14&hidenavigation=1&theme=dark)

### Tubular react in a grid list
Tubular can also be used to render data in a different layout.

![Grid](https://user-images.githubusercontent.com/36867256/85425888-6331da00-b53f-11ea-9359-88f83689da3a.gif)

[![Edit GridList -Example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/gridlist-example-forked-vfniq?file=/src/RemoteList.tsx&fontsize=14&hidenavigation=1&theme=dark)

### Run integrated sample

There is a sample included in this project, you can run it just by doing the following.

```shell
// Install all the dependencies
npm install
// Run the sample project
npm start
```

## i18n Support

Tubular React now includes a brand new Language Service that will translate the content of the grid to a preferred language.
Devs can also implement content on their language and import it to use this language.
By default, Tubular React comes with implementations in **English** and **Spanish**.
If any key content needs parameters to include in the translation, devs can pass the parameters in the `translate` function.

```ts
import { Lang } from 'tubular-react';

Lang.translate('PageNum', 16);
// => 'Page 16'
```