diff --git a/docs/cell-edit-props.md b/docs/cell-edit-props.md index cae2ca8..d71761f 100644 --- a/docs/cell-edit-props.md +++ b/docs/cell-edit-props.md @@ -59,6 +59,24 @@ const cellEdit = { } ``` +If you want to perform a async `beforeSaveCell`, you can do it like that: + +```js +const cellEdit: { + // omit... + beforeSaveCell(oldValue, newValue, row, column, done) { + setTimeout(() => { + if (confirm('Do you want to accep this change?')) { + done(); // contine to save the changes + } else { + done(false); // reject the changes + } + }, 0); + return { async: true }; + } +}; +``` + ## cellEdit.afterSaveCell - [Function] This callback function will be called after updating cell. diff --git a/docs/column-props.md b/docs/column-props.md index 08e4164..4b15d26 100644 --- a/docs/column-props.md +++ b/docs/column-props.md @@ -365,17 +365,27 @@ A new `String` will be the result of element headerAlign. ## column.events - [Object] -You can assign any [HTML Event](https://www.w3schools.com/tags/ref_eventattributes.asp) on table column via event property: +You can assign any [HTML Event](https://www.w3schools.com/tags/ref_eventattributes.asp) on table column via `events` property. + +`react-bootstrap-table2` currently only support following events which will receive some specific information: + +* onClick +* onDoubleClick +* onMouseEnter +* onMouseLeave +* onContextMenu ```js { // omit... events: { - onClick: e => { ... } + onClick: (e, column, columnIndex, row, rowIndex) => { ... }, } } ``` +If the events is not listed above, the callback function will only receive the `event` object. + ## column.headerEvents - [Object] `headerEvents` same as [`column.events`](#columnevents-object) but this is for header column. @@ -528,6 +538,27 @@ The return value can be a bool or an object. If your validation is pass, return } ``` +If you want to perform a asycn validation, you can do it like this: +```js +{ + // omit... + validator: (newValue, row, column, done) => { + settimeout(() => { + // async validation ok + return done(); + + // async validation not ok + return done({ + valid: false, + message: 'SOME_REASON_HERE' + }); + + }, 2000); + return { async: true }; + } +} +``` + ## column.editCellStyle - [Object | Function] You can use `column.editCellStyle` to custom the style of `` when cell editing. It like most of customizable functionality, it also accept a callback function with following params: diff --git a/website/blog/2018-10-29-version-bump.md b/website/blog/2018-10-29-version-bump.md new file mode 100644 index 0000000..a12d366 --- /dev/null +++ b/website/blog/2018-10-29-version-bump.md @@ -0,0 +1,26 @@ +--- +title: New Release (2018-10-29) +author: Allen Fang +authorURL: https://twitter.com/allenfang_tw +--- + +## Changed Packages + +We got following package version bump in this release: + +* `react-bootstrap-table-next@1.3.1` +* `react-bootstrap-table2-editor@1.2.1` + + +## Changelog + +### Bug fixes +* Try to fixed Uncaught TypeError: l.getData is not a function. + + +### Features + +### Enhancements +* Support async `cellEdit.beforeSaveCell`([#634](https://github.com/react-bootstrap-table/react-bootstrap-table2/pull/634)) +* Support async `column.validator`([#633](https://github.com/react-bootstrap-table/react-bootstrap-table2/pull/633)) +* Enhance `column.events`([#632](https://github.com/react-bootstrap-table/react-bootstrap-table2/pull/632)) \ No newline at end of file