3.2.3 • Published 4 years ago

react-datatable-with-bootstrap v3.2.3

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

react-datatable-with-bootstrap

React Bootstrap DataTable Package that handle server side Proccesing

NPM JavaScript Style Guide

Install

npm install --save react-datatable-with-bootstrap

Usage

import  React, {Component} from  'react'
import  ReactDataTable  from  'react-datatable-with-bootstrap'

export  default  class  App  extends  Component{
	constructor(props) {
	super(props);
	this.state = {
		dataTablesOptions: {
				'tableOptions': {
					'table_title': 'Hello',
         			'className': 'table table-hover'
				},
				'colums': []
				},
			apiData: {
				'pageNate': [0,10],
				'totalTableData':  12,
				'data': []
			}
		this.dataTableBtnAction = this.dataTableBtnAction.bind(this)
		this.dataTableOnChange = this.dataTableOnChange.bind(this)
		this.dataTableOnChangeInput = this.dataTableOnChangeInput.bind(this)
	}
	//Handling click of buton or fa-icon
	dataTableBtnAction(id, actionType,e){
		console.log('Onclick Id value: ', id);
		console.log('Onclick ACtion value: ', actionType);
		console.log('Onclick Action Event: ', e);
	}
	//This is where you need to introduce API which will be trigured automatical by the ReactDataTable component
	dataTableOnChange(state){
		console.log('Change States from DataTable: ', state)
	}
	//Hnadling Form inputs
	dataTableOnChangeInput(e){
		console.log(e.target.name+' :'+e.target.value);
	}
	render() {

	return(
				<ReactDataTable  dataTablesOptions={this.state.dataTablesOptions}
					dataTableBtnAction={this.dataTableBtnAction}
					dataTableOnChange={this.dataTableOnChange}
					dataTableData={this.state.apiData}
					dataTableOnChangeInput={this.dataTableOnChangeInput}
				/>

	)

	}

 

}

Columns json Example

1. Text

'colums': [
	{ 
	'column_properties': 
		{
		'name':  'id',
		'title':  '#',
		'width':  '',
		'allowSort':  false
		},
	'text':
		[
			{
				'name':  'name',
				'show':  true,
				'className':  ''
			},
			{
				'name':  'email',
				'show':  true,
				'className':  ''
			}
	]

2. Buttons

'colums': [
	{ 
	'column_properties': 
		{
		'name':  'id',
		'title':  'Buttons',
		'width':  '',
		'allowSort':  false
		},
	'button':
		[
			{
				'actionType':  'preview',
				'show':  true,
				'title':  'Button 1',
				'passValue':  'id',
				'className':  'btn btn-outline-success btn-sm'
			},
			{
				'actionType':  'preview',
				'show':  true,
				'title':  'Button 2',
				'passValue':  'id',
				'className':  'btn btn-outline-success btn-sm'
			}
	]

3. Fa Icons

'colums': [
	{ 
	'column_properties': 
		{
		'name':  'id',
		'title':  'Icons',
		'width':  '',
		'allowSort':  false
		},
	'fa_icon':
		[
			{
				'show':  true,
				'className':  'fa fa-free-code-camp'
			},
			{
				'show':  true,
				'className':  'fa fa-free-code-camp',
				'extra':
						{
							'depend_from_this_field':  'extra_icon',
							'conditional':  'boolean'
						}			
}
	]

4. Inputs

'colums': [
	{ 
	'column_properties': 
		{
		'name':  'id',
		'title':  'CheckBox',
		'width':  '',
		'allowSort':  false
		},
	'input':
		[
			{
				'show':  true,
				'name':  'cell',
				'id':  'cell',
				'input_type':  'checkbox',
				'className':  'custom-control custom-checkbox',
				'defaultChecked':  true,'
			},
			{
				'show':  true,
				'name':  'cell',
				'id':  'cell',
				'input_type':  'checkbox',
				'className':  'custom-control custom-checkbox',
				'defaultChecked':  true,'
			}
	]

API Response Json

apiData: {
	'pageNate': [0,10],
	'totalTableData':  12,
	'data': [
		{
			'id':  'Emmanuel Shekinah 1',
			'name':  'hhhdgddg',
			'cell':  12345,
			'age':  4,
			'extra_icon': true
		},
		{
			'id':  'Emmanuel Shekinah 1',
			'name':  'hhhdgddg',
			'cell':  12345,
			'age':  4,
			'extra_icon': true
		}

	]
}

License

MIT © emmanuelshekinah

3.2.3

4 years ago

3.2.2

4 years ago

3.2.1

4 years ago

3.2.0

4 years ago

3.1.2

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.10

4 years ago

3.0.9

5 years ago

3.0.8

5 years ago

3.0.7

5 years ago

3.0.6

5 years ago

3.0.5

5 years ago

3.0.4

5 years ago

3.0.3

5 years ago

3.0.2

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.1.34

5 years ago

2.1.33

5 years ago

2.1.32

5 years ago

2.1.31

5 years ago

2.1.28

5 years ago

2.1.29

5 years ago

2.1.30

5 years ago

2.1.27

5 years ago

2.1.25

5 years ago

2.1.26

5 years ago

2.1.24

5 years ago

2.1.23

5 years ago

2.1.22

5 years ago

2.1.21

5 years ago

2.1.20

5 years ago

2.1.19

5 years ago

2.1.18

5 years ago

2.1.17

5 years ago

2.1.16

5 years ago

2.1.15

5 years ago

2.1.13

5 years ago

2.1.12

5 years ago

2.1.11

5 years ago

2.1.10

5 years ago

2.1.9

5 years ago

2.1.8

5 years ago

2.1.7

5 years ago

2.1.6

5 years ago

2.1.5

5 years ago

2.1.4

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.18

5 years ago

2.0.15

5 years ago

2.0.16

5 years ago

2.0.17

5 years ago

2.0.13

5 years ago

2.0.14

5 years ago

2.0.11

5 years ago

2.0.7

5 years ago

2.0.12

5 years ago

2.0.6

5 years ago

2.0.9

5 years ago

2.0.10

5 years ago

2.0.8

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.24

5 years ago

2.0.0

5 years ago

1.0.23

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago