1.1.1 • Published 3 years ago

reactjs-table-component v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

reactjs-table-component

Table component for react js to quick render data objects in table grid

NPM JavaScript Style Guide

Install

npm install --save reactjs-table-component

Demo

Click for Demo

Usage

import React, { Component } from 'react'

import Table from 'reactjs-table-component'
import 'reactjs-table-component/dist/index.css'

class Example extends Component {
  render() {
    return <Table />
  }
}

API

NameTypeDefaultDescription
dataArray Array of objectsPlaceholder sample dataActual data to render in grid [{id:1,name:'ABC'},{id:2,name:'XYZ'}]
columnsArray or Array of Objects[] keys of data object will be uses if nullColumns to render in table (key should match data object keys) . Key Array ['id','name'] OR Object array for advanced control over table display properties [{key:'id',label:'Item ID',width: "40", align: "center" },{key:'name',width: "200"},{key:'Amount',width: "100", align:'right}] Object Keys: align:left,center,right [Default:left] width: Integer (Width of column)
tableClassStringtableCSS class name/names separated by space
captionString-Table caption
cellClassString-Table cell css class <td class="cellClass">
childrenDOM Object-Table body DOM object. Pass customized table body to render with custom layout <tr><td>value</td><td>Name<br/>Username</td><td><NewComponent/></td><td><button onClick={(e)=>someFunction(e)}></button></td></tr>
renderChildrenBooleanfalseRender children DOM
renderBodyBooleantrueRender default data grid body
noHeaderBooleantrueShow/Hide table header
headerCellCallbackFunction-Callback function to handle header cell click function(event){ // callback method }
cellCallbackFunction-Callback function to handle table body cell click function(event){ // callback method }

License

MIT © ktmcodelabs