2.3.4 • Published 4 years ago

onno-datatable v2.3.4

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

onno-datatable

=======

onno-datatable

NPM JavaScript Style Guide

Install

npm install --save onno-datatable
or
npm install --save-dev onno-datatable

Usage

import React, { Component } from 'react';

import Table, { Column } from 'onno-datatable';
import 'onno-datatable/dist/index.css';

class Example extends Component {
  	render() {
		return <Table
			data={teams}
			filterable={true}
			tableClassNames={['table', 'table-bordered', 'table-striped', 'table-hover', 'table-sm']}
			headerClassNames={['thead-dark']}
		>
			<Column label="Name" field="name" sortable={true} />
			<Column label="Status" field="enable" sortable={true} render={(each) => each.enable === 'Yes' ?
				(<Badge variant="success">Enabled</Badge>) :
				(<Badge variant="danger">Disabled</Badge>)} />
			<Column label="Action" hidden={!userInfo.isAdmin} render={(each) => (
				<>
					<a href="javascript:void(0)" className="mr-2 small" onClick={this.onChangeStatus(each)}>
						{each.enable === 'Yes' ?
							(<span className="text-danger"><i className="fas fa-trash-alt"></i> Disabled </span>) :
							(<span className="text-success"><i className="fas fa-eye"></i> Enable </span>)}
					</a>
					<a className="text-secondary small" onClick={this.onOpenEditForm(each)} href="javascript:void(0)">
						<i className="fas fa-edit"></i> Edit
								</a>
				</>
			)} />
		</Table>;
  	}
}

User guide

Table

Prop nameDescriptionDefault valueExample values
children (required)Includes many Columnsn/a
dataarray objects[]{ "Name": "Tiger Nixon", "Position": "System Architect" }
widthwidth of table'100%''90px'
pageSizesTotal pageSize value which are displayed on page size combobox5, 10, 25, 50, 75, 1007, 10, 40
filterableAllow search on tabletrue
sortAscIconIcon Sort Asc, display on headern/a
sortDescIconIcon Sort Desc, display on headern/a
sortIconIcon Sort, display on headern/a
tableClassNamesClassnames of table'table', 'table-bordered'
headerClassNamesClassnames of header[]

Column

Prop nameDescriptionDefault valueExample values
labelLabel of column, display on headern/a'Name', 'Age'
fieldfield valuen/a'name
sortableAllow to sort of columnfalse
hiddenShow or hide a columnfalse
renderCustom render celln/a{record.name}
sortingByDefault sort when render the first timen/a'ASC'

License

MIT © lamnt.it@gmail.com

2.3.4

4 years ago

2.3.3

4 years ago

2.3.0

4 years ago

2.3.2

4 years ago

2.3.1

4 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago