json-to-table-pagination

1.3.3 • Public • Published

json-to-table-pagination

When an array of JSON objects is passed to json-to-table-pagination, it will return the json values in a table format and adds pagination to it.

  1. Pass an array of objects, it will return a reactjs component with table and pagination
  2. Can select number of rows in a table per page
  3. Can go to any page number
  4. Click on any column header to sort in ascending/descending order
  5. Customize header background color
  6. Customize pagination arrows by showing either arrows or text in pagination
  7. By default nested objects are stringified and displayed. You can set 'flattenObjects' to true which flattens the objects and then displays
  8. Click on any value in the table and the value gets highlighted so that it can be copied easily

NPM JavaScript Style Guide

Install

npm install --save json-to-table-pagination

Usage

import React from 'react'
import { JSONToTable } from 'json-to-table-pagination'
 
const App = () => {
    const users = [
        {
            id: '111',
            firstname: 'Ram',
            lastname: 'Akunuru',
            email: 'ram@gmail.com'
        },
        {
            id: '222',
            firstname: 'Tony',
            lastname: 'Stark',
            email: 'tony@gmail.com'
        },
        {
            id: '333',
            firstname: 'Captain',
            lastname: 'America',
            email: 'captain@gmail.com'
        },
        ...
    ]
 
    // Below are the default options
    const options = {
        bgColor: '#1E88E5',
        useArrowIcons: true,
        flattenObjects: false
    }
 
    return <JSONToTable jsonFile={users} options={options} />
}
 
export default App

Alt text Alt text

License

MIT ©

Package Sidebar

Install

npm i json-to-table-pagination

Weekly Downloads

10

Version

1.3.3

License

MIT

Unpacked Size

69.8 kB

Total Files

6

Last publish

Collaborators

  • ramakunuru