react-jmtable

0.3.13Β β€’Β PublicΒ β€’Β Published

Welcome to react-jmtable πŸ‘‹

Version License: MIT

Get your data specification ready, your optimized table will pop up!

Install

yarn add react-jmtable

Usage

pass your data like this:

  const SAMPLE_HEADER = [
    { name: 'checkbox', label: '', type: 'checkbox', width: '4%' },
    { name: 'no', label: 'No', type: 'no', width: '6%' },
    { name: 'id', label: 'id', type: 'text', width: '8%' },
    { name: 'username', label: 'user name', type: 'text', width: '9%' },
    { name: 'tel', label: 'tel', type: 'tel', width: '9%' },
    { name: 'issuedAmount', label: 'issued amount', type: 'number', width: '14%' },
    { name: 'memo', label: 'memo', type: 'text', width: '8%' },
    { name: 'createdAt', label: 'created at', type: 'date', width: '8%' },
    { name: 'mod', label: 'Mod', type: 'button', width: '5%' },
    { name: 'del', label: 'del', type: 'del', width: '5%' },
  ];

  const SAMPLE_BODY = [{
    id: 1,
    username: 'Jae M. Choi',
    tel: 000-0000-0000,
    issuedAmount: 1000,
    memo: 'memo',
    mod: '',
    createdAt: new Date(),
  }];

  const { checkedIndexes, JmTable, tableBody } = useJmTable({
    // showSampleData: true,  // If you want to show sample data, set this to true
    tableHeader: SAMPLE_HEADER,
    tableBody: SAMPLE_BODY,
    customStyle: {
      tableWidth: '80%',
      tableBody: {
        background: 'lightBlue'
      }
    },
    handleEvent: {
      mod: e => console.log('mod button clicked', e),
      mod1: () => console.log('mod1 button clicked'),
      del: () => console.log('delete button clicked'),
    },
  });

  return <div className="App">{JmTable}</div>;


Author

πŸ‘€ Jae M. Choi

Show your support

Give a ⭐️ if this project helped you!


This README was generated with ❀️ by readme-md-generator

Package Sidebar

Install

npm i react-jmtable

Weekly Downloads

0

Version

0.3.13

License

MIT

Unpacked Size

63.4 kB

Total Files

50

Last publish

Collaborators

  • jaemche