Giter VIP home page Giter VIP logo

react-responsive-data-table's Introduction

react-responsive-data-table

npm npm npm npm

Responsive Data Table with Searching, Sorting, Pagination

Demo

Click Here

Installation

  1. Install React Table as a dependency
# NPM
$ npm install react-responsive-data-table
  1. Import the react-responsive-data-table module
// ES6
import Table from "react-responsive-data-table";

Example

import Table from 'react-responsive-data-table';

render() {
<Table style={{
    opacity: 0.8,
    backgroundColor: "#00113a",
    color: "#ffffff",
    textAlign: "center"
  }}
  tableStyle="table table-hover table-striped table-bordered table-borderless table-responsive"
  pages={true}
  pagination={true}
  onRowClick={() => {}} // if You Want Table Row Data OnClick then assign this {row => console.log(row)}
  page={true}
  errormsg="Error. . ."
  loadingmsg="Loading. . ."
  isLoading={false} 
  sort={true} 
  title="Customers"
  search={true}
  size={10}
  data={{
    head: {
      id: "ID",
      name: "Name",
      email: "Email",
      created_at: "Created At",
      orders: "Orders",
      last_order: "Last OrderResponse",
      total_spent: "Total Spent"
    },
    data: [
      {
        id: 218354810912,
        name: "Kattie Wisoky",
        email: "[email protected]",
        created_at: "2017-11-07T15:14:07.000+0000",
        orders: 6,
        last_order: "#2233",
        total_spent: 0
      },
      {
        id: 218354843680,
        name: "Vernon McLaughlin",
        email: "[email protected]",
        created_at: "2017-11-07T15:14:07.000+0000",
        orders: 4,
        last_order: "#1287",
        total_spent: 0
      },
      {
        id: 218354909216,
        name: "Jeffry Harber",
        email: "[email protected]",
        created_at: "2017-11-07T15:14:07.000+0000",
        orders: 2,
        last_order: "#2356",
        total_spent: 0
      }
    ]
  }} />
  }

Data

You have to pass data and head objects in data prop. head is for Header.

<Table
  data={{head:{},data:[]}}
/>

Props

These are all of the available props (and their default values) for the main <Table /> component.

{
    data={{
        head:{},
        data:[]
        }},
    style,
    pages: true,
    tableStyle: "table class name",
    pagination= true,
    page= true,
    title= "title",
    search= true,
    size= 10,
    errormsg= "Error message",
    loadingmsg= "Loading message",
    isLoading= false,
    sort= true,
    onRowClick= {() => {}} //function
}

Props Details

  • data - You have to pass data and head objects in data prop. head is for Header.
  • tableStyle - Bootstrap Table class name
  • style - Style for Table Header
  • pages - Boolean. Shows Pages Option to display number of records per page.[5,10,20,25,50]
  • pagination - Boolean. Shows Pagination if true.
  • page - Boolean. Shows Current page out of total pages if true.
  • title - String. Title for Table.
  • search - Boolean. Shows Searchbar if true.
  • size - Number Of Records that Shows in single page. You can Onle use 5,10,20,25,50.
  • errormsg - Error message.(Default is Error. . .)
  • loadingmsg - Loading message. (Default is Loading. . .)
  • isLoading - Boolean. Default is false
  • sort - Boolean. Default is
  • onRowClick - Function. You can redirect to another page by onRowClick, you can call any function by onRowClick, You can also get Row Data by onRowClick using ({row => console.log(row)}).

react-responsive-data-table's People

Contributors

inf3cti0n95 avatar miteshtagadiya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

react-responsive-data-table's Issues

Can`t map data.data

I tried this:

data:this.state.mesajex.map((list)=>
[
{
data_creare:list.data_creare,
detalii:list.detalii
}
]
)

And is shows loading forever like

filtering and sorting not working for all records.

I have used this data table. When i click on sorting, all records should be sorted. But in this grid sorting is working only on current page.

When i do filtering, it works fine. But the filtered records are not displaying on one page even if pagination limit is more.

For example, if i search "test" and there are 3 records on page 1 and 1 record on page 2 , and my pagination limit is 10, Instead of displaying 4 records on single page it displayed on respective page.

#pagination #react #sort #filter

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.