1.0.16 • Published 4 years ago

react-basic-table v1.0.16

Weekly downloads
26
License
MIT
Repository
github
Last release
4 years ago

react-basic-table

npm version npm build status

React basic table is a basic table library which handles basic table functions like paging, sorting, and filtering for you.

Usage

To install react basic table using npm run:

npm install --save react-basic-table

Then use react basic table like below:

import ReactBasicTable from 'react-basic-table';
...
render() {
    var columns = ['Name', 'State', 'Age', 'Note'];
    var rows = [
        [
        <span>Joe</span>,
        <span>PA</span>,
        <span>22</span>,
        <input type="text" />
        ],
        [
        <span>Jim</span>,
        <span>TX</span>,
        <span>55</span>,
        <input type="text" />
        ]
    ];
    return <ReactBasicTable rows={rows} columns={columns} />
};

Props

PropDescriptionDefaultExample
rowsAn array of rows. Every in this array is an array of components. This way you can render inputs and other components into the table.[][[<span>Joe</span> ],[<span>John</span>]]
columnsAn array of strings that are the names of the column.[]['Name']
pageSizeThe number of rows on a page.1015
hideColumnsAn array of column indexes that you want to hide. You can still filter on this column.[][1]
filterAn array of objects ({id, match}) that define filter criteria and column index. To use this you need to define a data-ReactBasicTable-value on the components in the row prop. This allows filtering on all components.[][{id: 0, match: 'John'}]
filterModeAn 'Or' or 'And' is accepting here. It is used in the filtering logic. In the case of 'Or' only one of the filter criteria needs to be true and in the case of 'And' they all need to be true. You can also pass 'Fuction' here to use advanced filtering logic declared in a function. See 'filterFunction' prop'Or''And'
filterFunctionA function used when 'filterMode' is 'Function'. This function takes an array of values and returns a bool if field passes the filter. (...values) => { return values[0] === 'OneA'; }Empty function(...values) => { return values[0] === 'OneA'; }
sortAn array of column indexes that you want to be sortable. To use this you need to define a data-ReactBasicTable-value on the components in the row prop. This allows filtering on all components.[][1]

Examples

Please see the example directory for examples of all of available functionality. We also have a code pen here.

1.0.16

4 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago