20181104 release

This commit is contained in:
AllenFang 2018-11-04 23:48:03 +08:00
parent 6f7ec7c647
commit 8188054e86
4 changed files with 74 additions and 2 deletions

View File

@ -121,6 +121,26 @@ const qualityFilter = selectFilter({
// omit...
```
> Note, the `selectOptions` can be an array also:
```js
const selectOptions = [
{ label: 0, value: 'good' },
{ label: 1, value: 'Bad' },
{ label: 2, value: 'unknown' }
];
const columns = [
..., {
dataField: 'quality',
text: 'Product Quailty',
formatter: cell => selectOptions.find(opt => opt.label === cell).value,
filter: selectFilter({
options: selectOptions
})
}];
```
The benifit is `react-bootstrap-table2` will render the select options by the order of array.
## MultiSelect Filter
Multi-select filter is almost same as regular select filterfilter :

View File

@ -20,9 +20,14 @@ By default behavior, user need to click on the selection column or the checkbox/
## Selection Management
Please check [`selectoRow.selected`](./row-select-props.html#selectrowselected-array), it's used for default selection usually but also can be used as a external selection control.
This is an example for [selection management](../storybook/index.html?selectedKind=Row%20Selection&selectedStory=Selection%20Management)
This is an example for [selection management](../storybook/index.html?selectedKind=Row%20Selection&selectedStory=Selection%20Management).
In addition, this is another example for [selection management](../storybook/index.html?selectedKind=Row%20Selection&selectedStory=Advance%20Selection%20Management)
## Customization
### Style/Class
Like column, we support to custom the style, class on the selecting row easily via following `selectRow` props:

View File

@ -183,18 +183,42 @@ const selectRow = {
};
```
> If you want to reject current select action, just return `false`:
```js
const selectRow = {
mode: 'checkbox',
onSelect: (row, isSelect, rowIndex, e) => {
if (SOME_CONDITION) {
return false;
}
}
};
```
## selectRow.onSelectAll - [Function]
This callback function will be called when select/unselect all and it only work when you configure [`selectRow.mode`](#selectrowmode-string) as `checkbox`.
```js
const selectRow = {
mode: 'checkbox',
onSelectAll: (isSelect, results, e) => {
onSelectAll: (isSelect, rows, e) => {
// ...
}
};
```
> If you want to control the final selection result, just return a row key array:
```js
const selectRow = {
mode: 'checkbox',
onSelectAll: (isSelect, rows, e) => {
if (isSelect && SOME_CONDITION) {
return [1, 3, 4]; // finally, key 1, 3, 4 will being selected
}
}
};
```
## selectRow.hideSelectColumn - [Bool]
Default is `false`, if you don't want to have a selection column, give this prop as `true`

View File

@ -0,0 +1,23 @@
---
title: New Release (2018-11-04)
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.4.0`
* `react-bootstrap-table2-editor@1.2.2`
## Changelog
### Bug fixes
### Features
### Enhancements
* Allow to call `setState` in `selectRow.onSelect` and `selectRow.onSelectAll`([#644](https://github.com/react-bootstrap-table/react-bootstrap-table2/pull/644))
* Allow to use array for select filter options([#646](https://github.com/react-bootstrap-table/react-bootstrap-table2/pull/646))