Skip to content

Commit 2a34c37

Browse files
committed
add document for cellEdit
1 parent 1fad5dd commit 2a34c37

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

docs/README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
## Props on BootstrapTable
44

5+
#### Required
6+
* [keyField (**required**)](#keyField)
7+
* [data (**required**)](#data)
8+
* [columns (**required**)](#columns)
9+
10+
#### Optional
11+
* [striped](#striped)
12+
* [bordered](#bordered)
13+
* [hover](#hover)
14+
* [condensed](#condensed)
15+
* [cellEdit](#cellEdit)
16+
517
### <a name='keyField'>keyField(**required**) - [String]</a>
618
`keyField` is a prop to tell `react-bootstrap-table2` which column is unigue key.
719

@@ -18,4 +30,28 @@ Same as `.table-bordered` class for adding borders on all sides of the table and
1830
### <a name='hover'>hover - [Bool]</a>
1931
Same as `.table-hover` class for adding a hover effect (grey background color) on table rows
2032
### <a name='condensed'>condensed - [Bool]</a>
21-
Same as `.table-condensed` class for makeing a table more compact by cutting cell padding in half
33+
Same as `.table-condensed` class for makeing a table more compact by cutting cell padding in half
34+
35+
### <a name='cellEdit'>cellEdit - [Bool]</a>
36+
Assign a valid `cellEdit` object can enable the cell editing on the cell.
37+
> Note: The `keyField` column can't be edited
38+
39+
Following is a `cellEdit` object:
40+
```js
41+
{
42+
mode: 'click',
43+
blurToSave: true,
44+
onEditing: (rowId, dataField, newValue) => { ... },
45+
beforeSaveCell: (oldValue, newValue, row, column) => { ... },
46+
afterSaveCell: (oldValue, newValue, row, column) => { ... },
47+
nonEditableRows: () => { ... }
48+
}
49+
```
50+
#### <a name='cellEdit.mode'>cellEdit.mode - [String]</a>
51+
`cellEdit.mode` possible value is `click` and `dbclick`. It's required value that tell `react-bootstrap-table2` how to trigger the cell editing.
52+
53+
#### <a name='cellEdit.blurToSave'>cellEdit.blurToSave - [Bool]</a>
54+
Default is `false`, enable it will be able to save the cell automatically when blur from the cell editor.
55+
56+
#### <a name='cellEdit.nonEditableRows'>cellEdit.nonEditableRows - [Function]</a>
57+
`cellEdit.nonEditableRows` accept a callback function and expect return an array which used to restrict all the columns of some rows as non-editable. So the each item in return array should be rowkey(`keyField`)

0 commit comments

Comments
 (0)