20181029 release

This commit is contained in:
AllenFang 2018-10-29 23:52:21 +08:00
parent c104dad224
commit 6f7ec7c647
3 changed files with 77 additions and 2 deletions

View File

@ -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.

View File

@ -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 `<td>` when cell editing. It like most of customizable functionality, it also accept a callback function with following params:

View File

@ -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))