Skip to content

Commit 0d3b76b

Browse files
committed
README.md
1 parent 2824039 commit 0d3b76b

File tree

5 files changed

+69
-65
lines changed

5 files changed

+69
-65
lines changed

README.md

+8-21
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,12 @@
11
# react-bootstrap-table2
22
Rebuilt [react-bootstrap-table](https://github.com/AllenFang/react-bootstrap-table)
33

4-
## The problems/features I want to solve
5-
* Performance
6-
* Fully compatiable with bootstrap 3 and 4(`react-bootstrap-table@4.0.0` already done)
7-
* Clean Code and Testing
8-
* Decrease the size of bundled file
9-
* **Split module/functionality from core module, make core module more lightweight**
10-
* Use [`storybook`](https://github.com/storybooks/storybook) to build examples
11-
* Support the aggregation(summary) view
12-
* Support the table footer
13-
* Support column/row span on header and body
14-
* Support sticky header
15-
* Support table section([react-bootstrap-table#721](https://github.com/AllenFang/react-bootstrap-table/pull/721))
16-
* Handle events well
17-
* Fix unalign issues
18-
* Make **stateless** table more easy to use(`react-bootstrap-table` alread have `remote` mode but have some bugs)
19-
* Customizable table
20-
* Support the nested data([react-bootstrap-table#50](https://github.com/AllenFang/react-bootstrap-table/issues/50◊))
21-
* Consider to support column resize
22-
* Consider to make animation on `react-bootstrap-table2` more easy
4+
## Development
5+
Please check [development guide](./docs/development.md).
6+
7+
## Usage
8+
See [getting started](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/getting-started.html).
9+
10+
## Roadmap
11+
See [release plans](https://react-bootstrap-table.github.io/react-bootstrap-table2/blog/2018/01/24/release-plan.html).
2312

24-
## The feature may lost on react-bootstrap-table
25-
* Have a great chance that I don't support the vertical scrollbar on table

docs/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,20 @@ A special case for remote pagination:
5959
remote={ { pagination: true, filter: false, sort: false } }
6060
```
6161

62-
In pagination case, even you only specified the paignation need to handle as remote, `react-bootstrap-table2` will handle all the table changes(`filter`, `sort`) as remote mode, because `react-bootstrap-table` only know the data of current page, but filtering, searching or sort need to work on overall datas.
62+
There is a apecial case for remote pagination, even you only specified the paignation need to handle as remote, `react-bootstrap-table2` will handle all the table changes(filter, sort etc) as remote mode, because `react-bootstrap-table2` only know the data of current page, but filtering, searching or sort need to work on overall datas.
6363

6464
### <a name='loading'>loading - [Bool]</a>
6565
Telling if table is loading or not, for example: waiting data loading, filtering etc. It's **only** valid when [`remote`](#remote) is enabled.
66-
When `loading` is `true`, `react-bootstrap-table` will attend to render a overlay on table via [`overlay`](#overlay) prop, if [`overlay`](#overlay) prop is not given, `react-bootstrap-table` will ignore the overlay rendering.
66+
When `loading` is `true`, `react-bootstrap-table2` will attend to render a overlay on table via [`overlay`](#overlay) prop, if [`overlay`](#overlay) prop is not given, `react-bootstrap-table2` will ignore the overlay rendering.
6767

6868
### <a name='overlay'>overlay - [Function]</a>
69-
`overlay` accept a factory funtion which should returning a higher order component. By default, `react-bootstrap-table-overlay` can be a good option for you:
69+
`overlay` accept a factory funtion which should returning a higher order component. By default, `react-bootstrap-table2-overlay` can be a good option for you:
7070

7171
```sh
72-
$ npm install react-bootstrap-table-overlay
72+
$ npm install react-bootstrap-table2-overlay
7373
```
7474
```js
75-
import overlayFactory from 'react-bootstrap-table-overlay';
75+
import overlayFactory from 'react-bootstrap-table2-overlay';
7676

7777
<BootstrapTable
7878
data={ data }

docs/cell-edit.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ const cellEdit = {
6767
```
6868

6969
### <a name='errorMessage'>cellEdit.errorMessage - [String]</a>
70-
This prop is not often used. Only used when you keep the error message in your application state and also handle the cell editing on remote mode.
70+
This prop is not often used. Only used when you want to keep the error message in your application state and also handle the cell editing on remote mode.
7171

7272
### <a name='onErrorMessageDisappear'>cellEdit.onErrorMessageDisappear - [Function]</a>
73-
This callback function will be called when error message discard.
73+
This callback function will be called when error message discard so that you can sync the newest error message to your state if you have.
7474

docs/columns.md

+36-15
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ dataField: 'address.city'
7373
```
7474

7575
## <a name='text'>column.text (**required**) - [String]</a>
76-
`text` will be apply as the column text in header column, if your header is not only text and you want to customize your header column, please check [`column.headerFormatter`](#headerFormatter)
76+
`text` will be the column text in header column by default, if your header is not only text or you want to customize the header column, please check [`column.headerFormatter`](#headerFormatter)
7777

7878
## <a name='hidden'>column.hidden - [Bool]</a>
7979
`hidden` allow you to hide column when `true` given.
@@ -89,9 +89,9 @@ dataField: 'address.city'
8989
## <a name='headerFormatter'>column.headerFormatter - [Function]</a>
9090
`headerFormatter` allow you to customize the header column and only accept a callback function which take three arguments and a JSX/String are expected for return.
9191

92-
* `column`: column object itself
93-
* `colIndex`
94-
* `components`: it's an object which contain all of other react element, like sort caret or filter etc.
92+
* `column`: current column object itself
93+
* `colIndex`: index of current column
94+
* `components`: an object which contain all of other react element, like sort caret or filter etc.
9595

9696
The third argument: `components` have following specified properties:
9797
```js
@@ -131,7 +131,7 @@ It's availabe to have custom class on table column:
131131
classes: 'id-custom-cell'
132132
}
133133
```
134-
In addition, `classes` also accept a callback function which have more power to custom the css class on each columns. This callback function take `4` arguments and a `string` is expect to return:
134+
In addition, `classes` also accept a callback function which have more power to custom the css class on each columns. This callback function take **4** arguments and a `String` is expected to return::
135135

136136

137137
```js
@@ -148,7 +148,7 @@ In addition, `classes` also accept a callback function which have more power to
148148

149149
**Return value**
150150

151-
A new `String` will be the result of element class.
151+
A new `String` will be the result as element class.
152152

153153
## <a name='headerClasses'>column.headerClasses - [String | Function]</a>
154154
It's similar to [`column.classes`](#classes), `headerClasses` is availabe to have customized class on table header column:
@@ -185,7 +185,7 @@ It's availabe to have custom style on table column:
185185
}
186186
```
187187

188-
In addition, similar to [`column.classes`](#classes), `style` also accept a callback function which have more power to customize the `inline style` on each columns. This callback function takes `4` arguments and an `Object` is expect to return:
188+
In addition, similar to [`column.classes`](#classes), `style` also accept a callback function which have more power to customize the `inline style` on each columns. This callback function takes **4** arguments and an `Object` is expect to return:
189189

190190

191191
```js
@@ -215,7 +215,7 @@ It's availabe to have customized inline-style on table header column:
215215
}
216216
```
217217

218-
Moreover, it also accept a callback function which takes 2 arguments and an `Object` is expect to return:
218+
Moreover, it also accept a callback function which takes **2** arguments and an `Object` is expect to return:
219219

220220
```js
221221
{
@@ -233,7 +233,7 @@ A new `Object` will be the result of element headerStyle.
233233

234234

235235
## <a name='title'>column.title - [Bool | Function]</a>
236-
`react-bootstrap-table2` is disable [`HTML title`](https://www.w3schools.com/tags/tag_title.asp) as default. You can assign `title` as `true` to enable the HTML title on table column and take `cell content` as default value. Additionally, you could customize title via a callback. It takes `4` arguments and a `String` is expect to return:
236+
`react-bootstrap-table2` is disable [`HTML title`](https://www.w3schools.com/tags/tag_title.asp) as default. You can assign `title` as `true` to enable the HTML title on table column and take `cell content` as default value. Additionally, you could customize title via a callback. It takes **4** arguments and a `String` is expect to return:
237237

238238

239239
```js
@@ -282,7 +282,7 @@ A new `String` will be the result of element headerTitle.
282282
## <a name='align'>column.align - [String | Function]</a>
283283
You can configure the [CSS text-align](https://www.w3schools.com/cssref/pr_text_text-align.asp) for table column by `align` property.
284284

285-
Besides, `align` also accept a callback function for dynamically setting text align. It takes `4` arguments and a `String` is expect to return:
285+
Besides, `align` also accept a callback function for dynamically setting text align. It takes **4** arguments and a `String` is expect to return:
286286

287287
```js
288288
{
@@ -385,14 +385,14 @@ Not only `Object`, `callback function` is also acceptable. It takes `4` argument
385385

386386
A new `Object` will be the result of element HTML attributes.
387387

388-
#### * Caution
388+
> Caution:
389389
390-
If `column.classes`, `column.style`, `column.title`, `column.hidden` or `column.align` was given at the same time, property `attrs` has lower priorty and it will be overwrited.
390+
> If `column.classes`, `column.style`, `column.title`, `column.hidden` or `column.align` was given at the same time, property `attrs` has lower priorty and it will be overwrited.
391391
392392
```js
393393
{
394394
// omit...
395-
title: true, // it will be chosen.
395+
title: true, // get higher priority
396396
attrs: { title: 'test' }
397397
}
398398
```
@@ -409,7 +409,7 @@ If `column.classes`, `column.style`, `column.title`, `column.hidden` or `column.
409409
}
410410
```
411411

412-
Additionally, customize the header attributes by a `2-arguments` callback function:
412+
Additionally, customize the header attributes by a **2** arguments callback function:
413413

414414
```js
415415
{
@@ -556,4 +556,25 @@ import { textFilter } from 'react-bootstrap-table2-filter';
556556
}
557557
```
558558

559-
For some reason of simple customization, `react-bootstrap-table2` allow you to pass some props to filter factory function. Please check [here](https://github.com/react-bootstrap-table/react-bootstrap-table2/tree/master/packages/react-bootstrap-table2-filter/README.md) for more detail tutorial.
559+
For some reason of simple customization, `react-bootstrap-table2` allow you to pass some props to filter factory function. Please check [here](https://github.com/react-bootstrap-table/react-bootstrap-table2/tree/master/packages/react-bootstrap-table2-filter/README.md) for more detail tutorial.
560+
561+
## <a name='filterValue'>column.filterValue - [Function]</a>
562+
Sometimes, if the cell/column value that you don't want to filter on them, you can define `filterValue` to return a actual value you wanna be filterd:
563+
564+
**Parameters**
565+
* `cell`: The value of current cell.
566+
* `row`: The value of current row.
567+
568+
**Return value**
569+
570+
A final `String` value you want to be filtered.
571+
572+
```js
573+
// omit...
574+
{
575+
dataField: 'price',
576+
text: 'Product Price',
577+
filter: textFilter(),
578+
filterValue: (cell, row) => owners[cell]
579+
}
580+
```

docs/row-selection.md

+18-22
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
# Row selection
33
`react-bootstrap-table2` supports the row selection feature. By passing prop `selectRow` to enable row selection. When you enable this feature, `react-bootstrap-table2` will append a new selection column at first.
44

5-
6-
## Available properties
7-
8-
The following are available properties in `selectRow`:
9-
10-
#### Required
5+
## Required
116
* [mode (**required**)](#mode)
7+
8+
## Optional
129
* [style](#style)
1310
* [classes)](#classes)
1411
* [bgColor](#bgColor)
@@ -19,22 +16,21 @@ The following are available properties in `selectRow`:
1916
* [onSelectAll](#onSelectAll)
2017
* [hideSelectColumn](#hideSelectColumn)
2118

22-
#### Optional
23-
24-
## <a name="mode">selectRow.mode - [String]</a>
19+
### <a name="mode">selectRow.mode - [String]</a>
2520

2621
Specifying the selection way for `single(radio)` or `multiple(checkbox)`. If `radio` was assigned, there will be a radio button in the selection column; otherwise, the `checkbox` instead.
2722

2823
#### values
29-
* `radio`
30-
* `checkbox`
24+
* **radio**
25+
* **checkbox**
3126

3227
#### examples
3328

3429
```js
3530
const selectRow = {
3631
mode: 'radio' // single row selection
3732
};
33+
3834
<BootstrapTable
3935
keyField='id'
4036
data={ products }
@@ -56,7 +52,7 @@ const selectRow = {
5652
/>
5753
```
5854

59-
## <a name='style'>selectRow.style - [Object | Function]</a>
55+
### <a name='style'>selectRow.style - [Object | Function]</a>
6056
`selectRow.style` allow you to have custom style on selected rows:
6157

6258
```js
@@ -75,7 +71,7 @@ const selectRow = {
7571
};
7672
```
7773

78-
## <a name='classes'>selectRow.classes - [String | Function]</a>
74+
### <a name='classes'>selectRow.classes - [String | Function]</a>
7975
`selectRow.classes` allow you to add css class on selected rows:
8076

8177
```js
@@ -94,7 +90,7 @@ const selectRow = {
9490
};
9591
```
9692

97-
## <a name='bgColor'>selectRow.bgColor - [String | Function]</a>
93+
### <a name='bgColor'>selectRow.bgColor - [String | Function]</a>
9894
The backgroud color when row is selected
9995

10096
```js
@@ -115,7 +111,7 @@ const selectRow = {
115111
};
116112
```
117113

118-
## <a name='nonSelectable'>selectRow.nonSelectable - [Array]</a>
114+
### <a name='nonSelectable'>selectRow.nonSelectable - [Array]</a>
119115
This prop allow you to restrict some rows which can not be selected by user. `selectRow.nonSelectable` accept an rowkeys array.
120116

121117
```js
@@ -125,8 +121,8 @@ const selectRow = {
125121
};
126122
```
127123

128-
## <a name='clickToSelect'>selectRow.clickToSelect - [Bool]</a>
129-
Able to select row when clicking on row.
124+
### <a name='clickToSelect'>selectRow.clickToSelect - [Bool]</a>
125+
Allow user to select row by clicking on the row.
130126

131127
```js
132128
const selectRow = {
@@ -135,10 +131,10 @@ const selectRow = {
135131
};
136132
```
137133

138-
> Note: if you also enable [cellEdit](./cell-edit.md), the `selectRow.clickToSelect` will deactivate the functionality of cell editing
134+
> Note: When you also enable [cellEdit](./cell-edit.md), the `selectRow.clickToSelect` will deactivate the functionality of cell editing
139135
> If you want to click on row to select row and edit cell simultaneously, you are suppose to enable [`selectRow.clickToEdit`](#clickToEdit)
140136
141-
## <a name='clickToEdit'>selectRow.clickToEdit - [Bool]</a>
137+
### <a name='clickToEdit'>selectRow.clickToEdit - [Bool]</a>
142138
Able to click to edit cell and select row
143139

144140
```js
@@ -149,7 +145,7 @@ const selectRow = {
149145
};
150146
```
151147

152-
## <a name='onSelect'>selectRow.onSelect - [Function]</a>
148+
### <a name='onSelect'>selectRow.onSelect - [Function]</a>
153149
This callback function will be called when a row is select/unselect and pass following three arguments:
154150
`row`, `isSelect` and `rowIndex`.
155151

@@ -162,7 +158,7 @@ const selectRow = {
162158
};
163159
```
164160

165-
## <a name='onSelectAll'>selectRow.onSelectAll - [Function]</a>
161+
### <a name='onSelectAll'>selectRow.onSelectAll - [Function]</a>
166162
This callback function will be called when select/unselect all and it only work when you configure [`selectRow.mode`](#mode) as `checkbox`.
167163

168164
```js
@@ -174,7 +170,7 @@ const selectRow = {
174170
};
175171
```
176172

177-
## <a name='hideSelectColumn'>selectRow.hideSelectColumn - [Bool]</a>
173+
### <a name='hideSelectColumn'>selectRow.hideSelectColumn - [Bool]</a>
178174
Default is `false`, if you don't want to have a selection column, give this prop as `true`
179175

180176
```js

0 commit comments

Comments
 (0)