1.7.1 • Published 11 months ago

@goktemkirez/react-table v1.7.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@goktemkirez/react-table

React Table with MUI

NPM JavaScript Style Guide npm downloads

Install

npm install --save @goktemkirez/react-table

Usage

import React, { useEffect, useState } from 'react'

import Table from '@goktemkirez/react-table'

const App = () => {
  const [data, setData] = useState([])

  useEffect(() => {
    fetch('https://dummyjson.com/c/3b32-4630-419c-9426')
      .then((res) => res.json())
      .then((res) => setData(res))
  }, [])
  
  return (
    <Table
        language="en" // tr(Turkish), en(English), pl(Polish), es(Spanish) are supported. Default language is tr(Turkish)
        title='Dummy Table'
        data={data}
        columns={[
          {
            name: 'dummyId', // object key in data
            title: 'Dummy ID', // custom name for column
            type: 'number' // data type
          },
          {
            name: 'dummyText',
            title: 'dummyText',
            type: 'string'
          },
          {
            name: 'dummyDate',
            title: 'dummyDate',
            type: 'date'
          },
          {
            name: 'dummyNumber',
            title: 'dummyNumber',
            type: 'number'
          },
          {
            name: 'dummyNumberWithDot',
            title: 'dummyNumberWithDot',
            type: 'number'
          },
          {
            name: 'dummyBool',
            title: 'dummyBool',
            type: 'bool'
          },
          {
            name: 'dummyBoolNumber',
            title: 'column with component',
            type: 'number',
            component: (value, row) => (
              <div style={{ backgroundColor: 'red', height: '100%' }}>
                {value} or {row.dummyBoolNumber}
              </div>
            ) // you can add custom component to column
          },
          {
            name: 'dummyUrl',
            title: 'dummyUrl',
            type: 'string',
            component: (value, row) => (
              <a href={value} target='_blank' rel='noopener noreferrer'>
                {value}
              </a>
            )
          }
        ]} 
        onNewButtonClick={() => {
          alert("New button clicked")
        }}
        onEditButtonClick={(row) => {
          alert(`ID: ${row.dummyId} row edit clicked`)
        }}
        rowTooltip={(row) => {
            return row.dummyBool && "dummyBool is true";
        }}
        showTotalsRow={true} // You can show sum of number values on totals row
    />
  )
}

License

MIT © goktemkirez

1.4.6

1 year ago

1.3.7

2 years ago

1.2.8

2 years ago

1.4.5

1 year ago

1.3.6

2 years ago

1.2.7

2 years ago

1.7.1

11 months ago

1.4.4

1 year ago

1.3.5

2 years ago

1.2.6

2 years ago

1.6.1

11 months ago

1.5.2

11 months ago

1.4.3

2 years ago

1.3.4

2 years ago

1.2.5

2 years ago

1.6.0

11 months ago

1.5.1

11 months ago

1.4.2

2 years ago

1.3.3

2 years ago

1.2.4

2 years ago

1.5.0

11 months ago

1.4.1

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.4.9

1 year ago

1.4.11

11 months ago

1.4.8

1 year ago

1.3.9

2 years ago

1.4.10

1 year ago

1.4.7

1 year ago

1.3.8

2 years ago

1.4.12

11 months ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago