Skip to content

Commit 403ed1f

Browse files
committed
resolve conflicts
2 parents 82c2313 + 8591a4f commit 403ed1f

32 files changed

+65890
-510
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["env", "react"]
3+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/node_modules/

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/node_modules/
2+
/example/

.snyk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
2+
version: v1.14.1
3+
ignore: {}
4+
# patches apply the minimum changes required to fix a vulnerability
5+
patch:
6+
SNYK-JS-LODASH-567746:
7+
- lodash:
8+
patched: '2020-05-01T07:34:26.121Z'

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
language: node_js

README.md

Lines changed: 70 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
# react-datatable
22

3+
[![npm version](https://img.shields.io/npm/v/@ashvin27/react-datatable.svg)](https://www.npmjs.com/package/@ashvin27/react-datatable)
4+
[![Known Vulnerabilities](https://snyk.io/test/github/ashvin27/react-datatable/badge.svg?targetFile=package.json)](https://snyk.io/test/github/ashvin27/react-datatable?targetFile=package.json)
5+
36
ReactDatatable is a component which provide ability to create multifunctional table using single component like jQuery Datatable. It's fully customizable and easy to integrate in any react component. Bootstrap compatible.
47

58
## Features
69
* Lightweight
710
* Fully customizable (JSX, templates, state, styles, callbacks)
8-
* Client-side & pagination
11+
* Client-side & Server Side Pagination
912
* Multi-sort
1013
* Filters
1114
* Minimal design
1215
* Fully controllable via optional props and callbacks
1316

1417
## Example
15-
[https://ashvin27.github.io/react-datatable/example/](https://ashvin27.github.io/react-datatable/example/)
18+
[http://react-datatable.in/](http://react-datatable.in/)
19+
20+
## Installation
21+
With [npm](https://npmjs.org/) installed, run
22+
```
23+
npm i @ashvin27/react-datatable
24+
```
1625

1726
## Usage
1827

@@ -90,7 +99,8 @@ class App extends Component {
9099
length_menu: [ 10, 20, 50 ],
91100
button: {
92101
excel: true,
93-
print: true
102+
print: true,
103+
extra: true,
94104
}
95105
}
96106

@@ -130,6 +140,35 @@ class App extends Component {
130140
}
131141
]
132142
}
143+
this.extraButtons =[
144+
{
145+
className:"btn btn-primary buttons-pdf",
146+
title:"Export TEst",
147+
children:[
148+
<span>
149+
<i className="glyphicon glyphicon-print fa fa-print" aria-hidden="true"></i>
150+
</span>
151+
],
152+
onClick:(event)=>{
153+
console.log(event);
154+
},
155+
},
156+
{
157+
className:"btn btn-primary buttons-pdf",
158+
title:"Export TEst",
159+
children:[
160+
<span>
161+
<i className="glyphicon glyphicon-print fa fa-print" aria-hidden="true"></i>
162+
</span>
163+
],
164+
onClick:(event)=>{
165+
console.log(event);
166+
},
167+
onDoubleClick:(event)=>{
168+
console.log("doubleClick")
169+
}
170+
},
171+
]
133172
}
134173

135174
editRecord(record) {
@@ -147,6 +186,7 @@ class App extends Component {
147186
config={this.config}
148187
records={this.state.records}
149188
columns={this.columns}
189+
extraButtons={this.extraButtons}
150190
/>
151191
</div>
152192
)
@@ -166,38 +206,43 @@ var ReactDatatable = require('@ashvin27/react-datatable')
166206
## Props
167207
| Name | Type | Description
168208
| ------------- | ------------- | ------------- |
169-
| config | Object[] | This props will used to specify datatable configuration
170-
| records | Object[] | This props will used to pass records/data to datatable
209+
| className | String | Datatable additional class, use to appy additional styling on table
210+
| tHeadClassName | String | Additional class to be put on the "thead" of the table
171211
| columns | Object[] | This props will used to specify datatable column configuration
212+
| config | Object[] | This props will used to specify datatable configuration
213+
| dynamic | boolean | This props will used to specify the table data will be server side or static
214+
| id | String | Identifier of datatable
215+
| records | Object[] | This props will used to table records
216+
| total_record | Number | This props will used to specify the total records in case of table data is server side.
217+
| onChange | Function(Object) | This method will call on table actions(page change, sorting, filtering, page length change)
218+
| onRowClicked | Function(Object) | This method will call when user click on a row, return row object.
219+
| extraButtons | Object[] | this props will add custom extra buttons to the table tools in the top right of the table header next to the built in export buttons
172220

173221
## Options
174222
| Name | Type | default | Description
175223
| ------------- | ------------- | ------------- | ------------- |
176-
| className | String | | Datatable additional class, use to appy additional styling on table
177-
| id | String | | Identifier of datatable
178-
| page_size | Number | 10 | Specify the page length (number of rows per page)
179-
| length_menu | Array[] | [10, 25, 50, 75, 100] | Specify the options in the page length `select` list.
224+
| key_column | string | id | Use to specify the key column name for each record
225+
| button | Object[] | { excel: false, print: false, csv: false } | Use to enable/disable export buttons(Excel, CSV, Print). By default buttons are disabled.
180226
| filename | String | "table" | Specify the export filename
181-
| button | Object[] | { excel: false, print: false } | Use to enable/disable export buttons. By default buttons are disabled.
227+
| length_menu | Array[] | [10, 25, 50, 75, 100] | Specify the options in the page length `select` list.
228+
| page_size | Number | 10 | Specify the page length (number of rows per page)
182229
| sort | Object[] | { column: "", order: "asc" } | Initial sorting order to apply to the datatable
230+
| show_filter | boolean | true | Use to specify either show or hide filter option
231+
| show_first | boolean | true | Use to specify either show or hide pagination first button
232+
| show_info | boolean | true | Use to specify either show or hide pagination info
233+
| show_last | boolean | true | Use to specify either show or hide pagination last button
234+
| show_length_menu | boolean | true | Use to specify either show or hide page length menu
235+
| show_pagination | boolean | true | Use to specify either show or hide pagination
236+
| pagination | string | basic | Use to specify the type of pagination. Available types: basic/advance
183237

184238
## Columns
185239
| Name | Type | default | Description
186240
| ------------- | ------------- | ------------- | ------------- |
187-
| key | String | | Specify the key of record which value will display in table cell
188-
| text | String | | Spcify the table column text
189-
| className | String | | Table column additional class fo styling
190241
| align | String | left | Specify the content alignment
191-
| width | Number | | Specify the column width
242+
| className | String | | Table column additional class fo styling (only for data columns use TrOnlyClassName for headers)
243+
| TrOnlyClassName | String | | Header column additional class ( only for headers ) WILL NOT automatically take className value if not set
244+
| key | String | | Specify the key of record which value will display in table cell
192245
| sortable | Boolean | false | Specify the column is sortable of not
193-
| cell | Function(record):string | | You can use any react component or JSX to display content in cells
194-
195-
196-
197-
## Install
198-
199-
With [npm](https://npmjs.org/) installed, run
200-
201-
```
202-
npm i @ashvin27/react-datatable
203-
```
246+
| text | String | | Specify the table column text
247+
| width | Number | | Specify the column width
248+
| cell | Function(record, index):string | | You can use any react component or JSX to display content in cells

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
theme: jekyll-theme-architect

0 commit comments

Comments
 (0)