3.2.3 • Published 3 years ago

react-datatable-with-bootstrap v3.2.3

Weekly downloads
96
License
MIT
Repository
github
Last release
3 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

3 years ago

3.2.2

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.1.2

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.10

3 years ago

3.0.9

3 years ago

3.0.8

3 years ago

3.0.7

3 years ago

3.0.6

3 years ago

3.0.5

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.1.34

3 years ago

2.1.33

3 years ago

2.1.32

3 years ago

2.1.31

3 years ago

2.1.28

3 years ago

2.1.29

3 years ago

2.1.30

3 years ago

2.1.27

3 years ago

2.1.25

3 years ago

2.1.26

3 years ago

2.1.24

3 years ago

2.1.23

3 years ago

2.1.22

3 years ago

2.1.21

3 years ago

2.1.20

3 years ago

2.1.19

3 years ago

2.1.18

3 years ago

2.1.17

3 years ago

2.1.16

4 years ago

2.1.15

4 years ago

2.1.13

4 years ago

2.1.12

4 years ago

2.1.11

4 years ago

2.1.10

4 years ago

2.1.9

4 years ago

2.1.8

4 years ago

2.1.7

4 years ago

2.1.6

4 years ago

2.1.5

4 years ago

2.1.4

4 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.18

4 years ago

2.0.15

4 years ago

2.0.16

4 years ago

2.0.17

4 years ago

2.0.13

4 years ago

2.0.14

4 years ago

2.0.11

4 years ago

2.0.7

4 years ago

2.0.12

4 years ago

2.0.6

4 years ago

2.0.9

4 years ago

2.0.10

4 years ago

2.0.8

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

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.24

4 years ago

2.0.0

4 years ago

1.0.23

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago