项目作者: miteshtagadiya

项目描述 :
Responsive Data Table with Searching, Sorting, Pagination
高级语言: CSS
项目地址: git://github.com/miteshtagadiya/react-responsive-data-table.git
创建时间: 2018-06-07T12:34:36Z
项目社区:https://github.com/miteshtagadiya/react-responsive-data-table

开源协议:MIT License

下载


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
  1. # NPM
  2. $ npm install react-responsive-data-table
  1. Import the react-responsive-data-table module
  1. // ES6
  2. import Table from "react-responsive-data-table";

Example

  1. import Table from 'react-responsive-data-table';
  2. render() {
  3. <Table style={{
  4. opacity: 0.8,
  5. backgroundColor: "#00113a",
  6. color: "#ffffff",
  7. textAlign: "center"
  8. }}
  9. tableStyle="table table-hover table-striped table-bordered table-borderless table-responsive"
  10. pages={true}
  11. pagination={true}
  12. onRowClick={() => {}} // if You Want Table Row Data OnClick then assign this {row => console.log(row)}
  13. page={true}
  14. errormsg="Error. . ."
  15. loadingmsg="Loading. . ."
  16. isLoading={false}
  17. sort={true}
  18. title="Customers"
  19. search={true}
  20. size={10}
  21. data={{
  22. head: {
  23. id: "ID",
  24. name: "Name",
  25. email: "Email",
  26. created_at: "Created At",
  27. orders: "Orders",
  28. last_order: "Last OrderResponse",
  29. total_spent: "Total Spent"
  30. },
  31. data: [
  32. {
  33. id: 218354810912,
  34. name: "Kattie Wisoky",
  35. email: "Kattie.Wisoky@data-generator.com",
  36. created_at: "2017-11-07T15:14:07.000+0000",
  37. orders: 6,
  38. last_order: "#2233",
  39. total_spent: 0
  40. },
  41. {
  42. id: 218354843680,
  43. name: "Vernon McLaughlin",
  44. email: "Vernon.McLaughlin@data-generator.com",
  45. created_at: "2017-11-07T15:14:07.000+0000",
  46. orders: 4,
  47. last_order: "#1287",
  48. total_spent: 0
  49. },
  50. {
  51. id: 218354909216,
  52. name: "Jeffry Harber",
  53. email: "Jeffry.Harber@data-generator.com",
  54. created_at: "2017-11-07T15:14:07.000+0000",
  55. orders: 2,
  56. last_order: "#2356",
  57. total_spent: 0
  58. }
  59. ]
  60. }} />
  61. }

Data

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

  1. <Table
  2. data={{head:{},data:[]}}
  3. ></Table>

Props

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

  1. {
  2. data={{
  3. head:{},
  4. data:[]
  5. }},
  6. style,
  7. pages: true,
  8. tableStyle: "table class name",
  9. pagination= true,
  10. page= true,
  11. title= "title",
  12. search= true,
  13. size= 10,
  14. errormsg= "Error message",
  15. loadingmsg= "Loading message",
  16. isLoading= false,
  17. sort= true,
  18. onRowClick= {() => {}} //function
  19. }

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)}).