1.0.0 • Published 4 years ago
react-redux-table v1.0.0
React-redux-table
A modular table made with React, Redux and React-Redux.
Installation
npm i react-redux-table
or
yarn add react-redux-tablePrerequisite
You must install and configure React, Redux and React-Redux in your project.
Redux state & configuration
State
React-redux-table state must be present in the store inside the object rrtable.
Configuration
You must add rrtableReducer to your project using combineReducers in the name of rrtable.
- combineReducers
import { rrtableReducer } from "react-redux-table";
export const rootReducer = combineReducers({
yourReducer: yourReducer,
rrtable: rrtableReducer,
});Usage
import React from 'react';
import Table from 'react-redux-table';
class Component extends React.Component {
render {
<>
<Table
headersArray={headersArray}
rowsContent={rowsContent}
title="Your title"
filter={true}
entriesSelector={entriesSelector}
showEntries={true}
hideButtons={false}
/>
</>
}
}Props
headersArray{object} : the content of column headers -
headersArray = [...{title: "your title", category: "yourCategory"},]rowsContent{[object]} : the content of rows
rowsContent = [
...[
...{cellValue: "value", category: "yourCorrespondingCategory"},
],
]title{string} optional : the title of the tablefilter{bool} optional : wether the filtering functionality is presententriesSelector{string} optional : the selector of displayed rows by pageshowEntries{bool} optional : wether the actual status along pages is displayedhideButtons{bool} optional : true to hide buttons
Example 1
import { Table } from "react-redux-table";
const headArray = [
{ title: "First Name", category: "firstName" },
{ title: "Last Name", category: "lastName" },
];
const rowsArray = [
[
{ cellValue: "Nicolas", category: "firstName" },
{ cellValue: "Tesla", category: "lastName" },
],
[
{ cellValue: "Leonardo", category: "firstName" },
{ cellValue: "Da Vinci", category: "lastName" },
],
[
{ cellValue: "Sherlock", category: "firstName" },
{ cellValue: "Holmes", category: "lastName" },
],
];
function App() {
return (
<>
<Table headersArray={headArray} rowsContent={rowsArray} />
</>
);
}Example 2
import { Table } from "react-redux-table";
const headArray = [
{ title: "First Name", category: "firstName" },
{ title: "Last Name", category: "lastName" },
];
const rowsArray = [
[
{ cellValue: "Nicolas", category: "firstName" },
{ cellValue: "Tesla", category: "lastName" },
],
[
{ cellValue: "Leonardo", category: "firstName" },
{ cellValue: "Da Vinci", category: "lastName" },
],
[
{ cellValue: "Sherlock", category: "firstName" },
{ cellValue: "Holmes", category: "lastName" },
],
];
function App() {
return (
<>
<Table
headersArray={headArray}
rowsContent={rowsArray}
title="Famous people"
filter={true}
entriesSelector={[10, 100]}
showEntries={true}
hideButtons={true}
/>
</>
);
}1.0.0
4 years ago
0.1.20
4 years ago
0.1.21
4 years ago
0.1.22
4 years ago
0.1.23
4 years ago
0.1.24
4 years ago
0.1.17
4 years ago
0.1.18
4 years ago
0.1.19
4 years ago
0.1.15
4 years ago
0.1.16
4 years ago
0.1.14
4 years ago
0.1.10
4 years ago
0.1.11
4 years ago
0.1.12
4 years ago
0.1.13
4 years ago
0.1.8
4 years ago
0.1.7
4 years ago
0.1.9
4 years ago
0.1.4
4 years ago
0.1.6
4 years ago
0.1.5
4 years ago
0.1.3
4 years ago
0.1.1
4 years ago
0.1.0
4 years ago