1.0.0 • Published 3 years ago

react-redux-table v1.0.0

Weekly downloads
-
License
-
Repository
github
Last release
3 years ago

React-redux-table



A modular table made with React, Redux and React-Redux.

Installation


npm i react-redux-table
or
yarn add react-redux-table

Prerequisite


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 table
  • filter {bool} optional : wether the filtering functionality is present
  • entriesSelector {string} optional : the selector of displayed rows by page
  • showEntries {bool} optional : wether the actual status along pages is displayed
  • hideButtons {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} />
    </>
  );
}

alt text


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}
      />
    </>
  );
}

alt text

1.0.0

3 years ago

0.1.20

3 years ago

0.1.21

3 years ago

0.1.22

3 years ago

0.1.23

3 years ago

0.1.24

3 years ago

0.1.17

3 years ago

0.1.18

3 years ago

0.1.19

3 years ago

0.1.15

3 years ago

0.1.16

3 years ago

0.1.14

3 years ago

0.1.10

3 years ago

0.1.11

3 years ago

0.1.12

3 years ago

0.1.13

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.9

3 years ago

0.1.4

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.3

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago